diff --git a/nixos/hosts/backups-rpi4/backup-script.nix b/nixos/hosts/backups-rpi4/backup-script.nix index 6d9ed53e..9103cf18 100644 --- a/nixos/hosts/backups-rpi4/backup-script.nix +++ b/nixos/hosts/backups-rpi4/backup-script.nix @@ -5,9 +5,9 @@ let #!${pkgs.stdenv.shell} # Send the gotify notification: -GOTIFY_TOKEN=`cat /var/run/secrets/gotify_token` +GOTIFY_TOKEN=`cat /var/run/secrets/gotify_token | head -n 1` payload="{\"message\": \"Backup has started\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: 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" | jq +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" drive1=`lsblk -o NAME,SERIAL | grep -v crypt | grep 9RGHYP8C | awk {'print $1'}` drive2=`lsblk -o NAME,SERIAL | grep -v crypt | grep 9RGXW93C | awk {'print $1'}` @@ -21,7 +21,7 @@ echo "Checking if the NAS is mounted on nuc-docker01:" check=$(ssh root@nuc-docker01 df -h | grep Storage | wc -l) if [[ $check != 3 ]] ; then payload="{\"message\": \"Backup stopped. nuc-docker01 does not have 3 mounts in Storage\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: 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" | jq + 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 @@ -108,7 +108,7 @@ echo -e "======= Time complete: `date`" echo "Sending completion message" payload="{\"message\": \"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 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" | jq +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" ''; in