How to auto backup using rsync

This guide will auto backup folder within same machine using rsync and crontab. You must be login as sudo account or root.

Creating script

vi /root/rsync.sh

Copy paste this script. Remember to change the source folder or target folder

folder=`date +%Y_%m_%d`
rsync -avH  /folder/to/backup /backup/$folder >> /var/log/rsync/acc

Make script executable.

chmod +x rsync.sh

or

chmod 755 rsync.sh

Create the folder rsync in /var/log

mkdir /var/log/rsync

Now add this script to your crontab. (Check this link for crontab reference)

crontab -e

# Run auto backup everynight
0 4 * * * /root/rsync.sh

Save the file… Hope this little guide helps!

Permalink 0 Comments Posted in Linux Tips & Tricks

Leave a Reply

You must be logged in to post a comment.



Fatal error: Call to undefined function get_pagination() in /home/.seurat/h_ronald/crossnodes.net/wp-content/themes/crossnodes/index.php on line 99