23 lines
539 B
Bash
23 lines
539 B
Bash
#!/usr/bin/env bash
|
|
set -Eeuo pipefail
|
|
|
|
UNIT=raspiBackup.service
|
|
|
|
if systemctl is-active --quiet "$UNIT"; then
|
|
echo "FEHLER: raspiBackup läuft bereits" >&2
|
|
exit 1
|
|
fi
|
|
|
|
RC=0
|
|
systemctl start --wait "$UNIT" || RC=$?
|
|
|
|
RESULT=$(systemctl show --value -p Result "$UNIT")
|
|
STATUS=$(systemctl show --value -p ExecMainStatus "$UNIT")
|
|
|
|
if (( RC != 0 )) || [[ "$RESULT" != "success" || "$STATUS" != "0" ]]; then
|
|
echo "FEHLER: raspiBackup: Result=$RESULT, Status=$STATUS" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "OK: raspiBackup erfolgreich abgeschlossen"
|