From df8097a0b4a2ee9cf61efe5e5ffba116755f2b01 Mon Sep 17 00:00:00 2001 From: albert Date: Wed, 2 Oct 2024 09:56:31 +0200 Subject: [PATCH] Update japan-rpi4 scripts --- nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh | 8 ++++---- nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh b/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh index 11385994..8f3f7472 100644 --- a/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh +++ b/nixos/hosts/backups-rpi4/scripts/rsync-data-vol.sh @@ -2,7 +2,7 @@ BACKUP_NAME="rsync-data-vol" 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" drivea=`lsblk -o NAME,SERIAL | grep -v luks | grep 9RGXW93C | awk {'print $1'}` @@ -21,7 +21,7 @@ echo "Drive 3: $drivec / $mountc / $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,7 +35,7 @@ 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.\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}" + payload="{\"message\": \"$BACKUP_NAME stopped. $BACKUP_NAME is still running.\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 @@ -44,7 +44,7 @@ fi check=$(ssh root@nuc-docker01 df -h | grep synology.servers.hs.net | 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 diff --git a/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh b/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh index 1fccc234..88c27d53 100644 --- a/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh +++ b/nixos/hosts/backups-rpi4/scripts/rsync-sysctl.sh @@ -2,7 +2,7 @@ BACKUP_NAME="rsync-sysctl" 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" # If an old backup is still running, don't continue @@ -15,7 +15,7 @@ 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.\nDate: `date`\", \"priority\": 2,\"title\": \"japan-rpi4: $BACKUP_NAME Backup Stopped\"}" + payload="{\"message\": \"$BACKUP_NAME stopped. $BACKUP_NAME is still running.\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 @@ -36,7 +36,7 @@ echo "Drive 3: $drivec / $mountc / $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 @@ -48,5 +48,5 @@ rsync -avr --delete --exclude=Downloads/ root@warsaw-ovh-01:/Storage/Data/Docker 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"