Skip to content

Instantly share code, notes, and snippets.

@numbnet
Created November 10, 2020 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numbnet/90b4b1c2f19cc1c3afa31f31db898048 to your computer and use it in GitHub Desktop.
Save numbnet/90b4b1c2f19cc1c3afa31f31db898048 to your computer and use it in GitHub Desktop.
Rsync
#!/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