6
0
Fork 0

Parametrise borgbackup exporter.

This commit is contained in:
Joachim Desroches 2021-11-16 13:46:35 +01:00
parent 973b9b26b4
commit 0175a771b9
No known key found for this signature in database
GPG key ID: 6778C9C29C02D691
2 changed files with 18 additions and 9 deletions

View file

@ -14,8 +14,19 @@ virtualenv venv
. venv/bin/activate
pip install prometheus_client
pip install dateutils
# Start service
service prometheus-borgbackup-exporter --ifstarted restart
service prometheus-borgbackup-exporter --ifstopped start
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

View file

@ -3,6 +3,9 @@
os=$(cat "${__global:?}/explorer/os")
mkdir -p "${__object:?}/files"
REPOS_DIR=$(cat "${__object:?}/parameter/repos-dir")
export REPOS_DIR
case "$os" in
debian|ubuntu)
__package python3-virtualenv
@ -32,9 +35,4 @@ case "$os" in
;;
esac
REPOS_DIR=$(cat "${__object:?}/parameter/repos-dir")
export REPOS_DIR
__directory /opt/prometheus-borgbackup-exporter
# Make sure the borgbackup user exist.
__user borgbackup --home "$REPOS_DIR" --create-home