Results 1 to 3 of 3
I've been googling a couple of days for this, but still haven't found a clear way to run my script once the media is inserted/detected/mounted.
I'm running a small Linux ...
- 03-22-2007 #1Just Joined!
- Join Date
- Mar 2007
- Posts
- 4
How to run a script on media insert??
I've been googling a couple of days for this, but still haven't found a clear way to run my script once the media is inserted/detected/mounted.
I'm running a small Linux server with SUSE 10.1, the PC (HP Media Center) has a bay for USB hard drive. This drive is used for backup purposes.
So ideally I want to start the backup when the drive is inserted into the bay.
I didn't find how to do this so far. I've been thinking of stupid CRON script that will check every 10 mins if drive is mounted and if it is - start the backup, but I hope there is some more natural way to do this... Something like if-up / if-down scripts for network interfaces.
Then the drive is inserted it get's automatically mounted on /media/$PRODUCT, I'm not sure this is automount feature, since I haven't configured it, it more looks a kernel/module feature. For the moment I've just reformated the drive into Reiser FS and changed mount point to /media/backup.
Anyone has any ideas?
- 03-22-2007 #2
You can supposedly do it with a udev rule. I haven't used this particular feature of udev so I can't vouch for its fitness, but modifying udev rules is pretty straightforward and is explained quite thoroughly in the above link.
Stand up and be counted as a Linux user!
- 03-23-2007 #3Just Joined!
- Join Date
- Mar 2007
- Posts
- 4
Thanks for prompt answer!
At first glance it looks it that is what i'm looking for. Will try to configure udev on my system and see if it works.


Reply With Quote