33 lines
806 B
Bash
Executable File
33 lines
806 B
Bash
Executable File
#!/bin/sh
|
|
|
|
VCS_TAG=$(cat "${__object:?}/parameter/version")
|
|
VCS_URL="https://code.recycled.cloud/RecycledCloud/prometheus-borgbackup-exporter/raw/tag/$VCS_TAG/prometheus-borgbackup-exporter"
|
|
|
|
cat << EOF
|
|
cd /opt/prometheus-borgbackup-exporter
|
|
|
|
# Fetch sources.
|
|
curl "$VCS_URL" -o prometheus-borgbackup-exporter
|
|
|
|
# Install virtualenv and dependencies.
|
|
virtualenv venv
|
|
. venv/bin/activate
|
|
pip install prometheus_client
|
|
pip install dateutils
|
|
EOF
|
|
|
|
# Start service: `service` does not support the same options on different OSes
|
|
os=$(cat "${__global:?}/explorer/os")
|
|
|
|
case "$os" in
|
|
ubuntu)
|
|
echo "systemctl restart prometheus-borgbackup-exporter"
|
|
;;
|
|
alpine)
|
|
cat <<- EOF
|
|
service prometheus-borgbackup-exporter --ifstarted restart
|
|
service prometheus-borgbackup-exporter --ifstopped start
|
|
EOF
|
|
;;
|
|
esac
|