Runnig a command automatically when (un)mounting - Linux

This is a discussion on Runnig a command automatically when (un)mounting - Linux ; Hello. I am looking for a way to automatically run a command (preferably chosen by a non-root user) right after mounting or right before unmounting a device. Specifically, I want to run a simple script synchronizing some data on an ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Runnig a command automatically when (un)mounting

  1. Runnig a command automatically when (un)mounting

    Hello.

    I am looking for a way to automatically run a command (preferably chosen
    by a non-root user) right after mounting or right before unmounting a
    device. Specifically, I want to run a simple script synchronizing some
    data on an USB flash drive with its hard disk backup every time the USB
    drive is plugged in or out.

    Does e.g. HAL or gnome-volume-manager/gnome-mount (I use GNOME) enable
    such a thing?

    Regards,
    --
    Krzysztof Lubanski

  2. Re: Runnig a command automatically when (un)mounting

    On Sat, 06 Oct 2007 18:55:36 +0000, Krzysztof Lubanski wrote:

    > Hello.
    >
    > I am looking for a way to automatically run a command (preferably chosen
    > by a non-root user) right after mounting or right before unmounting a
    > device. Specifically, I want to run a simple script synchronizing some
    > data on an USB flash drive with its hard disk backup every time the USB
    > drive is plugged in or out.
    >
    > Does e.g. HAL or gnome-volume-manager/gnome-mount (I use GNOME) enable
    > such a thing?
    >
    > Regards,


    KDE at least has a context menu 'safely remove this device', which I
    *think* calls umount. You might write a macro to sync the contents of
    whatever you're unplugging, _then_ umount. If you want to get really
    adventurous, discover where that context menu points, and insert lines to
    examine the device being removed and sync before unmounting if-and-only-if
    it's the device you want to sync up.

+ Reply to Thread