Update script

This commit is contained in:
iFargle 2023-12-14 13:13:19 +09:00
parent db723755c9
commit 86849c4e4a

View file

@ -25,89 +25,89 @@ if [[ $check != 3 ]] ; then
exit exit
fi fi
/bin/echo -e "======= Time started : `date`" echo -e "======= Time started : `date`"
if [[ `ps aux | grep rsync | grep -v grep | grep -v rsync-all` ]] ; then if [[ `ps aux | grep rsync | grep -v grep | grep -v rsync-all` ]] ; then
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "rsync still running. Exiting...." echo -e "rsync still running. Exiting...."
/bin/echo -e "======= Time complete: `date`" echo -e "======= Time complete: `date`"
exit exit
fi fi
/bin/echo -e "rsync -avr --delete --exclude=luks.img /Storage/Backups/Manual/Computers/ /mnt/$drive1/Backups/Manual/Computers/" echo -e "rsync -avr --delete --exclude=luks.img /Storage/Backups/Manual/Computers/ /mnt/$drive1/Backups/Manual/Computers/"
/usr/bin/rsync -avr --delete --exclude=luks.img root@nuc-docker01:/Storage/Backups/Manual/Computers/ /mnt/$drive1/Backups/Manual/Computers/ rsync -avr --delete --exclude=luks.img root@nuc-docker01:/Storage/Backups/Manual/Computers/ /mnt/$drive1/Backups/Manual/Computers/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Backups/Backblaze/ /mnt/$drive1/Backups/Backblaze/" echo -e "rsync -avr --delete /Storage/Backups/Backblaze/ /mnt/$drive1/Backups/Backblaze/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Backups/Backblaze/ /mnt/$drive1/Backups/Backblaze/ rsync -avr --delete root@nuc-docker01:/Storage/Backups/Backblaze/ /mnt/$drive1/Backups/Backblaze/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Backups/Logs/ /mnt/$drive1/Backups/Backblaze/" echo -e "rsync -avr --delete /Storage/Backups/Logs/ /mnt/$drive1/Backups/Backblaze/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Backups/Logs/ /mnt/$drive1/Backups/Logs/ rsync -avr --delete root@nuc-docker01:/Storage/Backups/Logs/ /mnt/$drive1/Backups/Logs/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Backups/Docker/ /mnt/$drive1/Backups/Docker/" echo -e "rsync -avr --delete /Storage/Backups/Docker/ /mnt/$drive1/Backups/Docker/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Backups/Docker/ /mnt/$drive1/Backups/Docker/ rsync -avr --delete root@nuc-docker01:/Storage/Backups/Docker/ /mnt/$drive1/Backups/Docker/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/Pictures/ /mnt/$drive1/Pictures/" echo -e "rsync -avr --delete /Storage/Video/Pictures/ /mnt/$drive1/Pictures/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/Pictures/ /mnt/$drive1/Pictures/ rsync -avr --delete root@nuc-docker01:/Storage/Video/Pictures/ /mnt/$drive1/Pictures/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/Books/ /mnt/$drive1/Books/" echo -e "rsync -avr --delete /Storage/Video/Books/ /mnt/$drive1/Books/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/Books/ /mnt/$drive1/Books/ rsync -avr --delete root@nuc-docker01:/Storage/Video/Books/ /mnt/$drive1/Books/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/Music/ /mnt/$drive1/Music/" echo -e "rsync -avr --delete /Storage/Video/Music/ /mnt/$drive1/Music/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/Music/ /mnt/$drive1/Music/ rsync -avr --delete root@nuc-docker01:/Storage/Video/Music/ /mnt/$drive1/Music/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete --exclude=Downloads/ /Storage/Data/ /mnt/$drive1/Data/" echo -e "rsync -avr --delete --exclude=Downloads/ /Storage/Data/ /mnt/$drive1/Data/"
/usr/bin/rsync -avr --delete --exclude=Downloads/ root@nuc-docker01:/Storage/Data/ /mnt/$drive1/Data/ rsync -avr --delete --exclude=Downloads/ root@nuc-docker01:/Storage/Data/ /mnt/$drive1/Data/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/Movies/ /mnt/$drive2/Movies/" echo -e "rsync -avr --delete /Storage/Video/Movies/ /mnt/$drive2/Movies/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/Movies/ /mnt/$drive2/Movies/ rsync -avr --delete root@nuc-docker01:/Storage/Video/Movies/ /mnt/$drive2/Movies/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/" echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[0-9]* /mnt/$drive1/TV_Shows/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[A-K]* /mnt/$drive1/TV_Shows/" echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[A-K]* /mnt/$drive1/TV_Shows/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[A-E]* /mnt/$drive1/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[A-E]* /mnt/$drive1/TV_Shows/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[L-M]* /mnt/$drive2/TV_Shows/" echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[L-M]* /mnt/$drive2/TV_Shows/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[F-M]* /mnt/$drive2/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[F-M]* /mnt/$drive2/TV_Shows/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/" echo -e "rsync -avr --delete /Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/ rsync -avr --delete root@nuc-docker01:/Storage/Video/TV_Shows/[N-Z]* /mnt/$drive3/TV_Shows/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "rsync -avr --delete /Storage/Video/YouTube /mnt/$drive3/YouTube/" echo -e "rsync -avr --delete /Storage/Video/YouTube /mnt/$drive3/YouTube/"
/usr/bin/rsync -avr --delete root@nuc-docker01:/Storage/Video/YouTube/ /mnt/$drive3/YouTube/ rsync -avr --delete root@nuc-docker01:/Storage/Video/YouTube/ /mnt/$drive3/YouTube/
/bin/echo -e "================================================================================" echo -e "================================================================================"
/bin/echo -e "======= Time: `date`" echo -e "======= Time: `date`"
/bin/echo -e "======= Time complete: `date`" echo -e "======= Time complete: `date`"
/bin/echo "Sending completion message" 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\": \"rocky-rpi4: Backup Complete\"}" 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" | jq
''; '';