LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 04-19-2012, 01:37 PM   #1
Kashif_Bash
LQ Newbie
 
Registered: Apr 2012
Posts: 20

Rep: Reputation: Disabled
usb detail via udev rule


I have written a udev rule that call a script to send email when a usb drive is attached/removed. so far its working fine. but i want to know if there is any way i can include detail of usb drive in my email? how can i get it using udev? like usb size, label, mounted on, time. following is my udev rule and send email script:

Code:
SUBSYSTEM=="usb", ACTION=="add", RUN+="/u/usb_added add %b"
usb_added script is:

Code:
sendEmail -f root@IP -t abc@live.com -s smtp.live.com:587 -m "USB Attached" -o username=xyz@live.com
 
Old 04-19-2012, 02:05 PM   #2
markush
Senior Member
 
Registered: Apr 2007
Location: Germany
Distribution: Slackware
Posts: 3,970

Rep: Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848Reputation: 848
Hi,

the problem is that in the moment when the mail is generated, such details as mountpoint etc don't yet exist.

The script had to wait until the device is mounted and then it could for example parse the output of
Code:
df -h
Markus
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Creating an udev rule mounting all usb drive as 666 Linux.tar.gz Linux - Hardware 20 11-23-2010 05:56 AM
First UDEV Rule, Not quite there ... orbit Slackware 7 02-22-2009 10:08 PM
udev rule: need help DPenguin Linux - Hardware 0 08-04-2008 07:29 PM
Can I make a udev rule for a particular usb port? kairen Slackware 3 02-15-2008 08:30 AM
Udev Rule Help Please Toods Slackware 1 11-23-2007 08:55 AM


All times are GMT -5. The time now is 11:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration