restic-scripts/backup.sh
2023-01-17 12:21:39 +00:00

19 lines
548 B
Bash

#!/bin/bash
source env.sh
echo "Backup $NAME at $DATE"
BACKUP_CMD=restic backup $BACKUP_DIR $BACKUP_PARAMS -e $BACKUP_EXCLUSIONS
running=$(pgrep -f "$BACKUP_CMD")
if [[ $running ]]; then
echo "Backup alreadying running : $running. Exiting..."
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail
exit
fi
echo "Not currently running. Continuing..."
curl https://hc-ping.com/$HEALTH_UUID/start
$PRE_RUN_SCRIPTS
$BACKUP_CMD
if [[ $? == 0 ]]; then
curl https://hc-ping.com/$HEALTH_UUID
else
curl https://hc-ping.com/$HEALTH_UUID/fail
fi