Announcement

Collapse
No announcement yet.

Run script on USB disk plugin

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Run script on USB disk plugin

    I've got a large external hard disk with two partitions that I'd like to automount and run a script after the mounting - the script does
    mount -o bind /media/CORTEX/music /home/me/music
    (CORTEX is the mount point of one of the partitions)
    and then also runs sync to backup any changes to the hard disk.

    At the moment I'm just running this script from the command line - is it possible to make this happen automatically when the disk is plugged in?
    It seems to me that I can't do this using KDE's media manager, as to set anything automatic up would cause the script to be done for all USB drives that are plugged in, which is not what I want.

    Any suggestions?

    #2
    Re: Run script on USB disk plugin

    The only solution crossing my (limited) mind:

    Solve the "wandering mount point problem" as discussed in your parallel thread, then relocate the script to the disk and create a "trigger" for the cron daemon to deal with (further reading).

    Comment


      #3
      Re: Run script on USB disk plugin

      It shouldn't be necessary to have cron poll the mount point every five mintues. I'm sure the HAL subsystem (or whatever Kubuntu uses these days), must be capable of triggering a script after it has detected and mounted a device.
      Anyone know how to set this up?

      Comment


        #4
        Re: Run script on USB disk plugin

        No. Well theoretically (AFAIK), at least you can use HAL Callouts:

        http://webcvs.freedesktop.org/hal/ha...ew=co#callouts

        But I wish you a lot of luck . They are way far from user friendly.

        Javier.

        Comment


          #5
          Re: Run script on USB disk plugin

          But I wish you a lot of luck Wink. They are way far from user friendly.
          Indeed. That's why I posted in the hope of someone pointing me in the way of an example script that does what I want (I'm sure I can't be the first person to want to do this).

          I've found example scripts on the forums and on google, trouble is they seem to be aimed at executing after the device is connected, but not necessarily after the device is mounted.

          Comment

          Working...
          X