script on unmount

Frode Egeland egeland at gmail.com
Sat Apr 12 06:33:18 BST 2008


Oops, I didn't spot the umount until after I hit "send".. apologies. :)
The umount would do the trick, assuming nothing else makes the device busy,
THEN you'd get the infinite loop I was worried about. ;)

On Sat, Apr 12, 2008 at 3:31 PM, Frode Egeland <egeland at gmail.com> wrote:

> That would seem to repeatedly call rsync as long as the folder is there.
> Probably not what you wanted.
> Anyone have a better way? :)
>
>
> On Sat, Apr 12, 2008 at 10:57 AM, Jackson Cooper <mail at jacksonc.com>
> wrote:
>
> > Sebastian,
> >
> > The way I'd do it is create a daemon with an infinite loop (I don't
> > know much about udev though) that looks for the folder
> > /media/nameofusbdongle, and if it exists execute the rsync line, then
> > an umount line. Something like...
> >
> > <CODE>
> > while true; do
> >    if [[ -d /media/nameofdongle ]]; then
> >        rsync -switches /media/nameofdongle /some/other/path
> >        umount -switches /media/nameofdongle
> >    else
> >        sleep 1
> >    fi
> > done
> > </CODE>
> >
> > Then to make it a daemon, you could use the start-stop-daemon program.
> > Type "man start-stop-daemon" in the terminal to find out more.
> >
> > - Jackson
> >
> >
> > On Fri, Apr 11, 2008 at 7:55 PM, Sebastian Spiess
> > <sebastian.spiess at gmail.com> wrote:
> > > hi all,
> > >  I want to sync some of my USB dongle folders when I plug it in. I
> > think I worked that out: create a rule
> > >  /etc/udev/rules.d/85-usbstick.rules and call the script to sync.
> > >
> > >  But how about when I want to unplug the thing? Then there is no
> > usb/hotplug event. Would the simplest thing be a script
> > >  with unmount/eject at the end?
> > >  How could I call this script through the icon (unmount menu) on the
> > desktop?
> > >  How to make the eject/unmount wait until rsync is done?
> > >
> > >  by the way what's the difference between unmount and eject?
> > >
> > >  thanks Sebastian
> > >
> > >  --
> > >  ubuntu-au mailing list
> > >  ubuntu-au at lists.ubuntu.com
> > >  https://lists.ubuntu.com/mailman/listinfo/ubuntu-au
> > >
> >
> > --
> > ubuntu-au mailing list
> > ubuntu-au at lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/ubuntu-au
> >
>
>
>
> --
> http://www.kiva.org/lender/frode
>
>


-- 
http://www.kiva.org/lender/frode
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.ubuntu.com/archives/ubuntu-au/attachments/20080412/05d221a3/attachment.htm 


More information about the ubuntu-au mailing list