Update japan-rpi4 scripts
This commit is contained in:
parent
49a254ab87
commit
df8097a0b4
2 changed files with 8 additions and 8 deletions
|
@ -2,7 +2,7 @@ BACKUP_NAME="rsync-data-vol"
|
||||||
GOTIFY_TOKEN=`cat /var/run/secrets/gotify_token | head -n 1`
|
GOTIFY_TOKEN=`cat /var/run/secrets/gotify_token | head -n 1`
|
||||||
|
|
||||||
echo "Sending start message"
|
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"
|
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'}`
|
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 any drive isn't found, exit:
|
||||||
if [[ $mounteda != 0 ]] || [[ $mountedb != 0 ]] || [[ $mountedc != 0 ]] ; then
|
if [[ $mounteda != 0 ]] || [[ $mountedb != 0 ]] || [[ $mountedc != 0 ]] ; then
|
||||||
echo "One or more drives is not mounted. Exiting"
|
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"
|
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
|
exit
|
||||||
fi
|
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
|
||||||
ps aux | grep $BACKUP_NAME | grep -v grep | wc -l
|
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"
|
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
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -44,7 +44,7 @@ fi
|
||||||
check=$(ssh root@nuc-docker01 df -h | grep synology.servers.hs.net | wc -l)
|
check=$(ssh root@nuc-docker01 df -h | grep synology.servers.hs.net | wc -l)
|
||||||
if [[ $check != 1 ]] ; then
|
if [[ $check != 1 ]] ; then
|
||||||
echo "Synology is not mounted on nuc-docker01: check returned $check"
|
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"
|
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
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -2,7 +2,7 @@ BACKUP_NAME="rsync-sysctl"
|
||||||
GOTIFY_TOKEN=`cat /var/run/secrets/gotify_token | head -n 1`
|
GOTIFY_TOKEN=`cat /var/run/secrets/gotify_token | head -n 1`
|
||||||
|
|
||||||
echo "Sending start message"
|
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"
|
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
|
# 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
|
||||||
ps aux | grep $BACKUP_NAME | grep -v grep | wc -l
|
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"
|
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
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -36,7 +36,7 @@ echo "Drive 3: $drivec / $mountc / $mountedc"
|
||||||
# If any drive isn't found, exit:
|
# If any drive isn't found, exit:
|
||||||
if [[ $mounteda != 0 ]] || [[ $mountedb != 0 ]] || [[ $mountedc != 0 ]] ; then
|
if [[ $mounteda != 0 ]] || [[ $mountedb != 0 ]] || [[ $mountedc != 0 ]] ; then
|
||||||
echo "One or more drives is not mounted. Exiting"
|
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"
|
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
|
exit
|
||||||
fi
|
fi
|
||||||
|
@ -48,5 +48,5 @@ rsync -avr --delete --exclude=Downloads/ root@warsaw-ovh-01:/Storage/Data/Docker
|
||||||
|
|
||||||
echo -e "======= Time complete: `date`"
|
echo -e "======= Time complete: `date`"
|
||||||
echo "Sending completion message"
|
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"
|
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"
|
||||||
|
|
Loading…
Reference in a new issue