Results 1 to 10 of 41

Thread: Running backup script with udev

Threaded View

  1. #9
    Join Date
    Mar 2008
    Beans
    4,714
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: Running backup script with udev

    Okay, I just did a test and managed to successfully autobackup a directory on to an NTFS partition on a USB flash drive.

    This is what I did:

    I made a file called
    Code:
    /etc/udev/rules.d/81-local.rules
    I used 81 because /etc/udev/rules.d/README says
    Files should be named xx-descriptive-name.rules, the xx should be
    chosen first according to the following sequence points:

    80 rules that run programs (but do not load modules)
    This is the contents of /etc/udev/rules.d/81-local.rules
    Code:
    SUBSYSTEM=="block", SUBSYSTEMS=="usb", KERNEL=="sd?1", RUN+="/usr/local/bin/test.sh"
    and this is the contents of /usr/local/bin/test.sh:
    Code:
    #!/bin/sh
    mount /dev/sdb1 /mnt
    rsync -a /home/user/test/ /mnt/test/
    One reason why your script was not working is because /dev/sdb1 had not been mounted anywhere at the moment sbackupd was being run. We can use udev, but we need to mount the partition manually first.

    I'm not familiar with how sbackupd works. Are you willing to try rsync? I like rsync.

    Also, let's start by making the script as simple as possible -- comment out the notify-send commands.

    Good luck with the chkdisk. Once you are done with that, it looks like it should be quite easy to setup autobackup using udev.

    Edit: Oh -- I'm very glad you got the drive to work again!
    Last edited by unutbu; March 12th, 2009 at 09:38 PM.

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
  •