From 4e023d44cf00d637c8c7cee70b041ca4d7e39024 Mon Sep 17 00:00:00 2001 From: albert Date: Mon, 16 Sep 2024 05:34:32 +0200 Subject: [PATCH] update backups-rpi4 --- nixos/hosts/backups-rpi4/scripts/rsync-media.sh | 12 ++++++------ nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nixos/hosts/backups-rpi4/scripts/rsync-media.sh b/nixos/hosts/backups-rpi4/scripts/rsync-media.sh index d26d420d..2b9c304f 100644 --- a/nixos/hosts/backups-rpi4/scripts/rsync-media.sh +++ b/nixos/hosts/backups-rpi4/scripts/rsync-media.sh @@ -2,7 +2,7 @@ BACKUP_NAME="rsync-media" GOTIFY_TOKEN=`cat /var/run/secrets/gotify_token | head -n 1` echo "Sending start message" -payload="{\"message\": \"$BACKUP_NAME Backup has started\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Started\"}" +payload="{\"message\": \"$BACKUP_NAME Backup has started\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: $BACKUP_NAME Backup Started\"}" curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload" driveb=`lsblk -o NAME,SERIAL | grep -v luks | grep 9RGHYP8C | awk {'print $1'}` @@ -21,7 +21,7 @@ echo "Drive 3: $drivec / $mount3 / $mountedc" # If any drive isn't found, exit: if [[ $mounteda != 0 ]] || [[ $mountedb != 0 ]] || [[ $mountedc != 0 ]] ; then echo "One or more drives is not mounted. Exiting" - payload="{\"message\": \"$BACKUP_NAME Backup stopped. One or more local drives are not mounted.\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}" + payload="{\"message\": \"$BACKUP_NAME Backup stopped. One or more local drives are not mounted.\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: $BACKUP_NAME Backup Stopped\"}" curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload" exit fi @@ -35,16 +35,16 @@ if [[ $count -ge 4 ]] ; then ps aux | grep $BACKUP_NAME | grep -v grep ps aux | grep $BACKUP_NAME | grep -v grep | wc -l - payload="{\"message\": \"$BACKUP_NAME stopped. $BACKUP_NAME is still running.\n $count \n.\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}" + payload="{\"message\": \"$BACKUP_NAME stopped. $BACKUP_NAME is still running.\n $count \n.\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: $BACKUP_NAME Backup Stopped\"}" curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload" exit fi # Check if the Synology is mounted -check=$(ssh root@nuc-docker01 df -h | grep synology.servers.hs.net | wc -l) +check=$(ssh root@nuc-docker01 df -h | grep \/volume1\/Storage | wc -l) if [[ $check != 1 ]] ; then echo "Synology is not mounted on nuc-docker01: check returned $check" - payload="{\"message\": \"Backup stopped. Synology isn't mounted\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}" + payload="{\"message\": \"Backup stopped. Synology isn't mounted\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: $BACKUP_NAME Backup Stopped\"}" curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload" exit fi @@ -103,5 +103,5 @@ rsync -avr --delete root@nuc-docker01:/Storage/Media/YouTube/ /mnt/$drivec/YouTu echo -e "======= Time complete: `date`" echo "Sending completion message" -payload="{\"message\": \"$BACKUP_NAME Backup completed\nDate: `date`\n`df -h | grep sda`\n`df -h | grep sdb`\n`df -h | grep sdc`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Complete\"}" +payload="{\"message\": \"$BACKUP_NAME Backup completed\nDate: `date`\n`df -h | grep sda`\n`df -h | grep sdb`\n`df -h | grep sdc`\", \"priority\": 2,\"title\": \"backups-rpi4: $BACKUP_NAME Backup Complete\"}" curl -X "POST" "https://gotify.sysctl.io/message" -H "accept: application/json" -H "Content-Type: application/json" -H "X-Gotify-Key: $GOTIFY_TOKEN" -d "$payload" diff --git a/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh b/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh index cc73da13..1fccc234 100644 --- a/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh +++ b/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh @@ -43,8 +43,8 @@ fi # Start the backups echo -e "======= Time started : `date`" -echo -e "rsync -avr --delete --exclude=Downloads/ root@framework-server:/Storage/Data/Docker/sysctl.io/ /mnt/$drivea/Data/Docker/sysctl.io/" -rsync -avr --delete --exclude=Downloads/ root@framework-server:/Storage/Data/Docker/sysctl.io/ /mnt/$drivea/Data/Docker/sysctl.io/ +echo -e "rsync -avr --delete --exclude=Downloads/ root@warsaw-ovh-01:/Storage/Data/Docker/sysctl.io/ /mnt/$drivea/Data/Docker/sysctl.io/" +rsync -avr --delete --exclude=Downloads/ root@warsaw-ovh-01:/Storage/Data/Docker/sysctl.io/ /mnt/$drivea/Data/Docker/sysctl.io/ echo -e "======= Time complete: `date`" echo "Sending completion message"