Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 18th May 2006, 22:17
c-man c-man is offline
Junior Member
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default rdiff-backup & list of files

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?
Reply With Quote
Sponsored Links
  #2  
Old 19th May 2006, 08:51
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 36,421
Thanks: 834
Thanked 5,500 Times in 4,329 Posts
Default

Try:

tar pcvfz mybackup.tar.gz /var/dir/file1 /tmp/file2 /etc/file3.conf
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 19th May 2006, 11:43
SiDdhartha SiDdhartha is offline
Junior Member
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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 <support@gdarkzone.de>
# 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
Reply With Quote
  #4  
Old 19th May 2006, 14:45
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,745 Times in 2,578 Posts
 
Default

Have a look here: http://www.howtoforge.com/linux_rdiff_backup
http://www.nongnu.org/rdiff-backup/examples.html
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Total backup of files and databases nvn Installation/Configuration 1 12th May 2006 11:26
Logging in to isp config Jrdgames General 43 6th March 2006 19:04
ISPCONFIG installed :81 broke leadrescue Installation/Configuration 13 26th February 2006 16:59
Totally Confused?? :( kingtux Installation/Configuration 7 9th February 2006 22:14
Backup files windows <-> linux namit Server Operation 3 5th January 2006 18:30


All times are GMT +2. The time now is 14:44.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.