20 lines
548 B
Bash
20 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
|