Difference between revisions of "Rsync"

From ArchWiki
Jump to: navigation, search
Line 23: Line 23:
 
NOTES:
 
NOTES:
 
Watch really good the commands -avrzhP is the main backup options, --log-file well, is the log file created with the backup date --delete means that files that you delete from the source dir will also be deleted from the backup dir. /home/ (you can change it) is the source /home.bck/ is the destination dir (which i have it on another hard drive but it doesn't matter).  
 
Watch really good the commands -avrzhP is the main backup options, --log-file well, is the log file created with the backup date --delete means that files that you delete from the source dir will also be deleted from the backup dir. /home/ (you can change it) is the source /home.bck/ is the destination dir (which i have it on another hard drive but it doesn't matter).  
 
--[[User:Jfgomez86|Jfgomez86]] 13:28, 28 February 2008 (EST)
 
  
 
I would suggest you though to look for other backup methods if this one doesn't suit you... it's very simple as you can see but it works for me.
 
I would suggest you though to look for other backup methods if this one doesn't suit you... it's very simple as you can see but it works for me.
 +
 +
--[[User:Jfgomez86|Jfgomez86]] 13:28, 28 February 2008 (EST)

Revision as of 18:28, 28 February 2008

Simple Rsync Backup Howto

First: Open a terminal and do:

sudo vim /etc/cron.daily/rsync.backup

Paste this code there:

#!/bin/bash
DATE=`date +%Y%m%d%H%M`
rsync -avrzhP --log-file=/var/log/backups/$DATE.log --delete /home/ /home.bck/ &> /dev/null


Make it executable:

sudo chmod +x /etc/cron.daily/rsync.backup

and that's it... it'll run every day as a cron job (meaning you have to have cron configured and working)

NOTES: Watch really good the commands -avrzhP is the main backup options, --log-file well, is the log file created with the backup date --delete means that files that you delete from the source dir will also be deleted from the backup dir. /home/ (you can change it) is the source /home.bck/ is the destination dir (which i have it on another hard drive but it doesn't matter).

I would suggest you though to look for other backup methods if this one doesn't suit you... it's very simple as you can see but it works for me.

--Jfgomez86 13:28, 28 February 2008 (EST)