Page 7 of 7 FirstFirst ... 567
Results 61 to 67 of 67

Thread: Rsync - What's YOUR setup like?

  1. #61
    Join Date
    Apr 2009
    Beans
    1,173

    Re: Simple Backup Strategy

    Quote Originally Posted by Penguin Guy View Post
    If only Ubuntu had something like this...
    I have seen plenty of positive comments about Back in Time, which does much the same thing for Linux.

    However, rsync is highly scaleable and Time Capsule is not - I have seen what happens when you restore Time Capsule to a different machine, change username or add a second user.

  2. #62
    Join Date
    Oct 2009
    Beans
    Hidden!
    Distro
    Ubuntu 16.04 Xenial Xerus

    Re: Simple Backup Strategy

    Wow a wireless hard drive. O_o

    I'm going to just run rsync as root, since it's only backing up stuff. I've got a script set so that I can restore without using root permissions, in the event I need to do so.

    Thanks for all the help everyone.
    Come to #ubuntuforums! We have cookies! | Basic Ubuntu Security Guide

    Tomorrow's an illusion and yesterday's a dream, today is a solution...

  3. #63
    Join Date
    Jul 2006
    Beans
    4,825

    Re: Simple Backup Strategy

    Quote Originally Posted by StuartN View Post
    I have seen plenty of positive comments about Back in Time, which does much the same thing for Linux.

    However, rsync is highly scaleable and Time Capsule is not - I have seen what happens when you restore Time Capsule to a different machine, change username or add a second user.
    That's what I heard too. Everywhere I ask, people say rsync is still top dog.

  4. #64
    Join Date
    Jun 2006
    Location
    USA
    Beans
    58
    Distro
    Ubuntu

    Re: Rsync - What's YOUR setup like?

    I have a rsync script in Python that is working well for me. It has 3 files the main backup.py and restformat.py used to formate my title and subtitles in the log file and backupexcluded.txt with the directories I do not what to backup.

    backup.py
    Code:
    #!/usr/bin/python
    
    import os
    from time import asctime
    import restformat
    
    #Variables
    backupruntime = asctime()
    sourcedir = "/home/coffeeboy/"
    backupdir = "/media/FreeAgent/backup/"
    incrementsdir = '/media/FreeAgent/backup-increments/' + backupruntime
    
    #Logging
    backuplog = open('/media/FreeAgent/rsync-backup.log', 'a')
    print >> backuplog, (restformat.title(backupruntime))
    print >> backuplog, ('Making increments directory: "' + incrementsdir + '"\n')
    
    #Make incrementsdir
    os.mkdir(incrementsdir)
    
    #Logging
    print >> backuplog, (restformat.subtitle('BEGIN BACKUP'))
    backuplog.close()
    
    #Run rsync backup command with Linux logging
    os.system('rsync -arEtb --delete --stats --log-file-format="%i %o %f %n" --exclude-from=/home/coffeeboy/bin/backupexcluded.txt --backup-dir=' + '"' + incrementsdir + '" ' + sourcedir + ' ' + backupdir + ' >> ' + '/media/FreeAgent/rsync-backup.log')
    
    
    #Logging
    backuplog = open('/media/FreeAgent/rsync-backup.log', 'a')
    print >> backuplog, (restformat.subtitle('END BACKUP'))
    print >> backuplog, ('\n\n')
    backuplog.close()
    enter your username for all coffeeboys and change /media/FreeAgent to you desired backup location. You will need to mkdir both an backup-increments folder and a backup folder and creat a rsync-backup.log in the backup location.


    restformat.py
    Code:
    #!/usr/bin/python
    
    def title(mytitle='reStructueredText Title'):
        'Retuns mytitle formatted as a restructeredText tilte.'
        return '======================================='+'\n'+ mytitle + '\n' + '======================================='
    
    def subtitle(mysubtitle='reStructeredText Subtitle'):
        'Returns mysubtitle formatted as a reStructeredText substring.'
        return mysubtitle + '\n' + '---------------------------------'
    This formates the title and subtitle lines used in the log file.

    The backupexcluded.txt file is a list of all visible and hidden files and folders (one per line) that I do not want to backup. [i.e. I do not backup up my .VirtualBox directory because of the size.


    An example log file output:

    =======================================
    Fri Nov 13 12:23:01 2009
    =======================================
    Making increments directory: "/media/FreeAgent/backup-increments/Fri Nov 13 12:23:01 2009"

    BEGIN BACKUP
    ---------------------------------

    Number of files: 14088
    Number of files transferred: 4
    Total file size: 9327826172 bytes
    Total transferred file size: 767443 bytes
    Literal data: 767443 bytes
    Matched data: 0 bytes
    File list size: 328252
    File list generation time: 0.003 seconds
    File list transfer time: 0.000 seconds
    Total bytes sent: 1111946
    Total bytes received: 16066

    sent 1111946 bytes received 16066 bytes 150401.60 bytes/sec
    total size is 9327826172 speedup is 8269.26
    END BACKUP
    ---------------------------------

    If anyone can help I would like to get rsync to print out a list of only the files that have been updated since the last backup as well as those that have been deleted (thus are being moved to increments). I can only seem to get the above output or a list of all files in the backup path, which is a little over kill for my log file.

    Also if I could get some suggestions on how to use a config file for source and backup dirs and the like that would be cool. I am rather new to Python and just really getting my feet wet.

    Thank you
    Last edited by coffee; November 15th, 2009 at 11:12 PM. Reason: looking for some help in the log file output.
    Time is moving forward, but is our understanding following?

  5. #65
    Join Date
    Apr 2009
    Beans
    1,173

    Re: Rsync - What's YOUR setup like?

    Quote Originally Posted by coffee View Post
    If anyone can help I would like to get rsync to print out a list of only the files that have been updated
    Does rsync -i (or --itemize) do what you want? This is a list of every action taken, which you can save and grep for new copies, updates or deletions.

  6. #66
    Join Date
    Jun 2006
    Location
    USA
    Beans
    58
    Distro
    Ubuntu

    Question Re: Rsync - What's YOUR setup like?

    Quote Originally Posted by StuartN View Post
    Does rsync -i (or --itemize) do what you want? This is a list of every action taken, which you can save and grep for new copies, updates or deletions.
    I have tried the -i option but am not sure how to emplement the grep solution. An example would be cool if you don't minde.
    Time is moving forward, but is our understanding following?

  7. #67
    Join Date
    Jun 2006
    Location
    USA
    Beans
    58
    Distro
    Ubuntu

    Arrow Re: Rsync - What's YOUR setup like?

    I have moved my code conversations to this new thread.
    The code has updated and gotten a little stronger. I seem to be stuck with posting it in line as I already have. The upload keeps failing. I have the code bundled in a tar file but even still no luck.
    Time is moving forward, but is our understanding following?

Page 7 of 7 FirstFirst ... 567

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •