Created
October 20, 2019 13:06
-
-
Save guysoft/bb5f9fb7aaea2346565c3eafa6239210 to your computer and use it in GitHub Desktop.
Nightly snapshot script, needs an email script at /home/guy/stuff/scripts/email
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Include | |
+ /dev/console | |
+ /dev/initctl | |
+ /dev/null | |
+ /dev/zero | |
# Exclude | |
- /dev/* | |
- /run/* | |
- /proc/* | |
- /sys/* | |
- /tmp/* | |
- lost+found/ | |
- /media/* | |
- /mnt/* | |
- /srv/* | |
- /media/* | |
- var/lib/docker/aufs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
SNAPSHOT_DEVICE=/dev/sdd1 | |
# rsync backup script | |
mount $SNAPSHOT_DEVICE /mnt/snapshot | |
if [ -d /mnt/snapshot/laptop_nightly/ ] | |
then | |
sudo sh -c " | |
rsync -av --delete-excluded --exclude-from=/home/guy/stuff/scripts/snapshot/rootsystem_backup.lst / /mnt/snapshot/laptop_nightly/rootsystem --progress > /mnt/snapshot/laptop_nightly/rootsystem_log; | |
date > /mnt/snapshot/laptop_nightly/rootsystem_BACKUP | |
" | |
umount $SNAPSHOT_DEVICE | |
if [ -d /mnt/snapshot/laptop_nightly/ ] | |
then | |
python /home/guy/stuff/scripts/email "Laptop root nightly backup FAILED TO UNMOUNT /dev/sdd1 $(date)" | |
fi | |
python /home/guy/stuff/scripts/email "Laptop root nightly backup finished. All systems green. $(date)" | |
else | |
python /home/guy/stuff/scripts/email "Laptop root nightly backup FAILED at mount $(date)" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment