33 lines
No EOL
1.1 KiB
Bash
33 lines
No EOL
1.1 KiB
Bash
#!/bin/bash
|
|
|
|
set -eo pipefail # you cann add u into -eo, but it drives me nuts so I won't
|
|
|
|
if [[ -n "${BASHD_DEBUG}" ]]; then # a inevitability that this will be used
|
|
set -x
|
|
fi
|
|
|
|
trap cleanup EXIT # A little more robust cleanup
|
|
|
|
cleanup() {
|
|
# We can clean up any temp files or what nots, but for now a place holder
|
|
true
|
|
}
|
|
|
|
source ./config.bash
|
|
|
|
# Run backups via restic
|
|
|
|
bkpwd=$(read_json "$JSON_FILE" "restic" "password")
|
|
|
|
export RESTIC_PASSWORD="$bkpwd"
|
|
|
|
# Stuff to backup
|
|
|
|
/usb/scripts/bin/restic -r sftp:nbak@192.168.1.168:/storage/backup/openwrt backup /etc
|
|
curl -d "ETC backed up" 192.168.1.168:83/openwrt_backup
|
|
/usb/scripts/bin/restic -r sftp:nbak@192.168.1.168:/storage/backup/openwrt backup /usb/scripts
|
|
curl -d "Scripts backed up" 192.168.1.168:83/openwrt_backup
|
|
/usb/scripts/bin/restic -r sftp:nbak@192.168.1.168:/storage/backup/openwrt backup /root
|
|
curl -d "Root backed up" 192.168.1.168:83/openwrt_backup
|
|
/usb/scripts/bin/restic -r sftp:nbak@192.168.1.168:/storage/backup/openwrt backup /usb/vnstat/vnstat.db
|
|
curl -d "Vnstat backed up" 192.168.1.168:83/openwrt_backup |