[SOLVED] Triggering of run script after pluging USB device

This forum is dedicated to advanced help and support :

Ask here your questions about advanced usage of Mageia. For example you may post here all your questions about network and automated installs, complex server configurations, kernel tuning, creating your own Mageia mirrors, and all tasks likely to be touchy even for skilled users.

[SOLVED] Triggering of run script after pluging USB device

Postby mackowiakp » May 27th, '13, 23:57

I want to trigger of start running my own script after plugging particular device to USB port. How can I obtain information about plugging new device to USB and info about unplugging?
Last edited by mackowiakp on Jun 9th, '13, 17:36, edited 1 time in total.
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 660
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Triggering of run script after pluging USB device

Postby GlennsPref » May 28th, '13, 09:48

Hi, lsusb will give you some info.
GlennsPref
 
Posts: 22
Joined: Apr 16th, '12, 07:47

Re: Triggering of run script after pluging USB device

Postby mackowiakp » May 28th, '13, 09:55

Yep, lsusb. But I want to trigger script running at the time the USB device is plugged in. So - using lsusb - I will have to check every minutes (from cron for example) the status of lsusb. But I just want to trigger the action just after plugging. Is the any way?
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 660
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Triggering of run script after pluging USB device

Postby doktor5000 » May 28th, '13, 20:12

Nope, lsusb is totally not useful for this.

What you basically need is a custom udev rule. Check https://wiki.archlinux.org/index.php/Udev and https://wiki.archlinux.org/index.php/Ud ... udev_rules
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18018
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Triggering of run script after pluging USB device

Postby mackowiakp » May 28th, '13, 22:29

Yep. A little bit complicated - but I will try...
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 660
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland

Re: Triggering of run script after pluging USB device

Postby mackowiakp » Jun 9th, '13, 17:36

I was not as difficult as I though. Just i made step-by-step everything from proposed links and it simply works!
Linux is like wigwam. No Windows, no Gates but Apache inside

WARNING ! The administrator has the right to refuse to install WINDOWS, invoking the conscience clause
mackowiakp
 
Posts: 660
Joined: May 23rd, '13, 07:32
Location: Gdynia, Poland


Return to Advanced support

Who is online

Users browsing this forum: No registered users and 1 guest