Created
November 10, 2020 01:40
-
-
Save numbnet/90b4b1c2f19cc1c3afa31f31db898048 to your computer and use it in GitHub Desktop.
Rsync
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 | |
BDIR='/home/backup'; | |
FDIR= '/'; | |
EXCLUDE='{"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/home/backup/*","/media/*","/lost+found"}'; | |
if [ -d $BDIR ]; then | |
echo "Folder exists" | |
cd /mnt && ln -s $BDIR; | |
else | |
mkdir $BDIR | echo 'Folder "$BDIR" is create'; | |
fi | |
rsync -aAXv --delete-after --exclude=$EXCLUDE $FDIR $BDIR; | |
exit | |
#### Info #### | |
## For AutoBackup,save in /etc/cron.daily/backup | |
##link# curl --raw https://pastebin.com/raw/ddAdx23v > ~/backup.sh | chmod +x ~/backup.sh | cp -r ~/backup.sh /etc/cron.daily/backup | chmod +x /etc/cron.daily/backup; | |
##$ rsync -a --delete --quiet $FDIR $BDIR; | |
##$ rsync -aAXv --delete-after --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt/backup; | |
##$ rsync -aAXv --delete-after --exclude={"/boot/*","/etc/*","/lib/*","/media/*","/opt/*","/sbin/*","/sys/*","/usr/*","/bin/*","/dev/*","/home/*","/lib64/*","/mnt/*","/proc/*","/run/*","/srv/*","/tmp/*","/var/*"} / /home/backup; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment