first commit

This commit is contained in:
Paul Wilde 2023-01-17 12:21:39 +00:00
commit 5aa78f7a1a
6 changed files with 38 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
env.sh

19
backup.sh Normal file
View file

@ -0,0 +1,19 @@
#!/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

9
env.sample.sh Normal file
View file

@ -0,0 +1,9 @@
NAME=Backup Name
BACKUP_DIR=/dir/to/back/up
BACKUP_PARAMS=""
HEALTHCHECK_UUID="healthchecks.io uuid"
export AWS_ACCESS_KEY_ID=
export AWS_SECRET_ACCESS_KEY=
export RESTIC_REPOSITORY="s3:https://repo.tld/bucket/sub-bucket"
export RESTIC_PASSWORD=V3RYSecuRepaSsWord

3
init.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
source env.sh
restic init

3
readme.md Normal file
View file

@ -0,0 +1,3 @@
A set of scripts to simplify running restic backup jobs via cron.
Also includes curl resquests to healthchecks.io service for monitoring purposes

3
snapshots.sh Normal file
View file

@ -0,0 +1,3 @@
#!/bin/bash
source env.sh
restic snapshots