If i want to backup only this files: /var/dir/file1 /tmp/file2 /etc/file3.conf It is possible to do it with one single line of code?
If it maybe helps: I wrote a little shellscript to use rdiff-backup via cronjob. Code: #!/bin/bash # script for rdiff-backup automation via cronjob # by Marc Aschmann <[email protected]> # 2006-05-02 v0.3 # directory for logfile state='/var/log/rdiff-backup.log' log='/var/log/rdiff-last.log' # drive info for backup device (I expect a mounted external device!) disk='/dev/sdc1' mountpoint='/media/backup' # directories to backup (here are the recommended dirs) # if you want to exclude files, just add them like '- /home/username/music' # IMPORTANT: first entry hast to be an inlclude and NEVER forget to exclude '/' # or you'll end up with a lot of files ;) source0='/home' source1='/etc' source2='/var' source3='/opt' source4='- /' source5='- /home/<username>/music/' source6='- /home/<username>/.gdesklets/' source7='- /home/<username>/.Trash/' # target to backup to target='/media/backup/backup' # how long to keep old files retention='4W' # check if script is running as root if [ "$(id -u)" = "0" ]; then # check if your backup drive is mounted... could be vital if mount -l | grep "$disk on $mountpoint" ; then #create a list of directories echo $source0 > dirlist echo $source1 >> dirlist echo $source2 >> dirlist echo $source3 >> dirlist echo $source4 >> dirlist echo $source5 >> dirlist echo $source6 >> dirlist echo $source7 >> dirlist # target should be present! if [ "$target" ]; then echo "-----------------------------------------------------------------" >> $state echo $(date '+%Y-%m-%d %H:%M:%S')" -> backup start" >> $state # backup files and write stdout and stderr to file rdiff-backup --include-globbing-filelist dirlist / $target &> $log # just for the protocol -> what did we backup and/or ignore echo "Includes and excludes: " >> $state cat < dirlist >> $state # remove the dirlist rm dirlist # remove old files and write stderr to file echo rdiff-backup --remove-older-than $retention $target 2>> $log echo "successfully removed files older than "$retention >> $state # I prefer keeping my files, my files ;) But could be nice for security reasons.... # chown root $target # chmod 744 $target echo $(date '+%Y-%m-%d %H:%M:%S')" -> backup end" >> $state echo " " >> $state else # write output as errormsg to file echo $(date '+%Y-%m-%d %H:%M:%S')" -> error: target (backup) directory does not exist!" >> $state echo $(date '+%Y-%m-%d %H:%M:%S')" -> backup end" >> $state echo " " >> $state exit fi else # write output as errormsg to file echo $(date '+%Y-%m-%d %H:%M:%S')" -> error: The expected backup media was not mounted!" >> $state echo $(date '+%Y-%m-%d %H:%M:%S')" -> backup end" >> $state exit fi exit else # in case script is not running as root, drop the errorlog @ userdir log=/home/$USER/Desktop/rdiff-backup.log # write output as errormsg to file echo $(date '+%Y-%m-%d %H:%M:%S')" -> error: The script must be rund unter root!" >> $state exit fi
Have a look here: http://www.howtoforge.com/linux_rdiff_backup http://www.nongnu.org/rdiff-backup/examples.html