Results 1 to 8 of 8

Thread: Suggestions for a backup solution...

  1. #1
    Join Date
    Oct 2007
    Beans
    Hidden!

    Question Suggestions for a backup solution...

    I've been looking into a good solution for the following situation...To simplify:

    I have a laptop, a dock for the laptop and an external hard drive connected to the dock. When the laptop is in use it is removed from the dock, when the laptop is not in use it is docked. Here is what I am looking to do...

    When I dock the laptop, and the external hard drive mounts I would like to automatically incrementally backup the contents of the laptop hard drive to the external hard drive. After the backup is completed (successfully or unsuccessfully) I would like it to shut down or possibly suspend the laptop.

    I have a few years experience using linux, and now use it as my primary operating system, I am familiar with using cron/crontab, but haven't had much experience with rsync.

    (GUI solutions are out of the question.)

    Thank you in advance for any help/suggestions.
    Last edited by trekrem; November 12th, 2008 at 11:37 AM.

  2. #2
    Join Date
    Apr 2006
    Location
    Sweden
    Beans
    60
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Suggestions for a backup solution...

    I think the best way would be to write a udev-rule. Something like this perhaps:
    http://www.linuxquestions.org/questi...ion...-529113/

  3. #3
    Join Date
    Oct 2007
    Beans
    Hidden!

    Re: Suggestions for a backup solution...

    Thank you, if the udev script works that would solve running the script automatically upon the drive being mounted...

    As for the actual rsync script, I have been looking over the man page for rsync and can figure that out, the only issue remaining would be having the machine shut down or possibly suspend after the script has completed. (No specific time the laptop would be docked, so a cron job probably wouldn't work.)
    Last edited by trekrem; November 12th, 2008 at 11:38 AM.

  4. #4
    Join Date
    Mar 2006
    Location
    Nerderlands
    Beans
    1,349
    Distro
    Ubuntu

    Re: Suggestions for a backup solution...

    bash scripts are run line-by-line. So if you have a line with the rsync command, and a line below that to shutdown, it will wait for the rsync to finish, then try to shutdown.
    "Please choose a different password, the one you have chosen is in use by UID 1432"

  5. #5
    Join Date
    Oct 2007
    Beans
    Hidden!

    Re: Suggestions for a backup solution...

    Excellent, thanks justleen, this should work out nicely then...Thanks for the help.

    (This thread will be marked solved after the solutions are tested and confirmed working.)

    Again thank you kaptengu and justleen.




    In the mean time, any tips for the rsync script would be very helpful...Looking to have maybe 7 separate daily incremental backup folders and 1 full current backup folder.
    Last edited by trekrem; November 12th, 2008 at 11:47 AM.

  6. #6
    Join Date
    Apr 2006
    Location
    Sweden
    Beans
    60
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Suggestions for a backup solution...

    Maybe the script could look something like this:
    Code:
    #!/bin/bash
    NOW=`date '+%Y-%m'-%d_%H:%M`
    mkdir -p /media/usb/backup/{current,old/$NOW}
    rsync -av --delete /home/user/ /media/usb/backup/current
    cp -al /media/usb/backup/current /media/usb/backup/old/$NOW
    #for DELDIR in "$(find /media/usb/backup/old -maxdepth 1 -type d -mtime +7)"
    #do
    #rm -rf $DELDIR
    #done
    shutdown -h now

  7. #7
    Join Date
    Apr 2006
    Location
    Sweden
    Beans
    60
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: Suggestions for a backup solution...


  8. #8
    Join Date
    May 2008
    Beans
    185

    Re: Suggestions for a backup solution...


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
  •