test changes
This commit is contained in:
parent
b5b31dbe97
commit
28b56eed84
1 changed files with 9 additions and 8 deletions
17
backup.sh
17
backup.sh
|
@ -1,12 +1,13 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
source env.sh
|
source env.sh
|
||||||
|
DATE=$(date +"%Y-%m-%d %H:%M:%S")
|
||||||
echo "Backup $NAME at $DATE"
|
echo "Backup $NAME at $DATE"
|
||||||
BACKUP_CMD=restic backup $BACKUP_DIR
|
BACKUP_CMD="restic backup $BACKUP_DIR"
|
||||||
if [[ $BACKUP_PARAMS ]]; then
|
if [[ $BACKUP_PARAMS ]]; then
|
||||||
BACKUP_CMD=$BACKUP_CMD $BACKUP_PARAMS
|
BACKUP_CMD="$BACKUP_CMD $BACKUP_PARAMS"
|
||||||
fi
|
fi
|
||||||
if [[ $BACKUP_EXCLUDE_FILE ]]; then
|
if [[ $BACKUP_EXCLUDE_FILE ]]; then
|
||||||
BACKUP_CMD=$BACKUP_CMD --exclude-file $BACKUP_EXCLUDE_FILE
|
BACKUP_CMD="$BACKUP_CMD --exclude-file $BACKUP_EXCLUDE_FILE"
|
||||||
fi
|
fi
|
||||||
running=$(pgrep -f "$BACKUP_CMD")
|
running=$(pgrep -f "$BACKUP_CMD")
|
||||||
if [[ $running ]]; then
|
if [[ $running ]]; then
|
||||||
|
@ -15,12 +16,12 @@ if [[ $running ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
echo "Not currently running. Continuing..."
|
echo "Not currently running. Continuing..."
|
||||||
curl https://hc-ping.com/$HEALTH_UUID/start
|
curl https://hc-ping.com/$HEALTHCHECK_UUID/start
|
||||||
$PRE_RUN_SCRIPTS
|
$(pwd)/$PRE_RUN_SCRIPT
|
||||||
$BACKUP_CMD
|
$BACKUP_CMD
|
||||||
if [[ $? == 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
$POST_RUN_SCRIPTS
|
$POST_RUN_SCRIPT
|
||||||
curl https://hc-ping.com/$HEALTH_UUID
|
curl https://hc-ping.com/$HEALTHCHECK_UUID
|
||||||
else
|
else
|
||||||
curl https://hc-ping.com/$HEALTH_UUID/fail
|
curl https://hc-ping.com/$HEALTHCHECK_UUID/fail
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue