update backup scripts

This commit is contained in:
albert 2024-03-03 11:12:08 +09:00
parent 7a2653ae81
commit f8d0558b28
No known key found for this signature in database
GPG key ID: 64F6C4EB46C4543A
2 changed files with 26 additions and 26 deletions

View file

@ -37,9 +37,9 @@ echo "Drive 2: $drive2"
echo "Drive 3: $drive3" echo "Drive 3: $drive3"
echo "Checking if the NAS is mounted on nuc-docker01:" echo "Checking if the NAS is mounted on nuc-docker01:"
check=$(ssh root@nuc-docker01 df -h | grep Storage | wc -l) check=$(ssh root@nuc-docker01 df -h | grep 192.168.1.100)
if [[ $check != 3 ]] ; then if [[ $check != 1 ]] ; then
payload="{\"message\": \"Backup stopped. nuc-docker01 does not have 3 mounts in Storage\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: Backup Stopped\"}" payload="{\"message\": \"Backup stopped. Synology isn't mounted\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" 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
@ -73,18 +73,18 @@ rsync -avr --delete root@nuc-docker01:/Storage/Backups/Docker/ /mnt/$drive1/Back
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/Pictures/ /mnt/$drive1/Pictures/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Pictures/ /mnt/$drive1/Pictures/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/Pictures/ /mnt/$drive1/Pictures/ rsync -avr --delete root@nuc-docker01:/Storage/Media/Pictures/ /mnt/$drive1/Pictures/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/Books/ /mnt/$drive1/Books/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Books/ /mnt/$drive1/Books/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/Books/ /mnt/$drive1/Books/ rsync -avr --delete root@nuc-docker01:/Storage/Media/Books/ /mnt/$drive1/Books/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/Music/ /mnt/$drive1/Music/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Music/ /mnt/$drive1/Music/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/Music/ /mnt/$drive1/Music/ rsync -avr --delete root@nuc-docker01:/Storage/Media/Music/ /mnt/$drive1/Music/
# echo -e "================================================================================" # echo -e "================================================================================"
# echo -e "======= Time: `date`" # echo -e "======= Time: `date`"
@ -93,33 +93,33 @@ rsync -avr --delete root@nuc-docker01:/Storage/Video/Music/ /mnt/$drive1/Music/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/Movies/ /mnt/$drive2/Movies/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/Movies/ /mnt/$drive2/Movies/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/Movies/ /mnt/$drive2/Movies/ rsync -avr --delete root@nuc-docker01:/Storage/Media/Movies/ /mnt/$drive2/Movies/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[A-K]* /mnt/$drive1/TV_Shows/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[A-K]* /mnt/$drive1/TV_Shows/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[A-E]* /mnt/$drive1/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[A-E]* /mnt/$drive1/TV_Shows/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[L-R]* /mnt/$drive2/TV_Shows/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[L-R]* /mnt/$drive2/TV_Shows/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[F-R]* /mnt/$drive2/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[F-R]* /mnt/$drive2/TV_Shows/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[S-Z]* /mnt/$drive3/TV_Shows/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[S-Z]* /mnt/$drive3/TV_Shows/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[S-Z]* /mnt/$drive3/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Media/TV_Shows/[S-Z]* /mnt/$drive3/TV_Shows/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Video/YouTube /mnt/$drive3/YouTube/" echo -e "rsync -avr --delete root@nuc-docker01:/Storage/Media/YouTube /mnt/$drive3/YouTube/"
rsync -avr --delete root@nuc-docker01:/Storage/Video/YouTube/ /mnt/$drive3/YouTube/ rsync -avr --delete root@nuc-docker01:/Storage/Media/YouTube/ /mnt/$drive3/YouTube/
echo -e "================================================================================" echo -e "================================================================================"
echo -e "======= Time: `date`" echo -e "======= Time: `date`"
@ -167,9 +167,9 @@ echo "Drive 2: $drive2"
echo "Drive 3: $drive3" echo "Drive 3: $drive3"
echo "Checking if the NAS is mounted on nuc-docker01:" echo "Checking if the NAS is mounted on nuc-docker01:"
check=$(ssh root@nuc-docker01 df -h | grep Storage | wc -l) check=$(ssh root@nuc-docker01 df -h | grep 192.168.1.100)
if [[ $check != 3 ]] ; then if [[ $check != 1 ]] ; then
payload="{\"message\": \"Data Vol Backup stopped. nuc-docker01 does not have 3 mounts in Storage\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: Data Vol Backup Stopped\"}" payload="{\"message\": \"Data Vol Backup stopped. Synology isn't mounted\nDate: `date`\", \"priority\": 2,\"title\": \"backups-rpi4: Data Vol 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