Reputation: 711
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:
SUBSYSTEM=="usb", ACTION=="add", RUN+="/u/usb_added add %b"
usb_added script is:
sendEmail -f root@IP -t [email protected] -s smtp.live.com:587 -m "USB Attached" -o [email protected]
Upvotes: 4
Views: 340
Reputation: 711
I found the way by using udevadm monitor --environment
. This gives complete details when a USB device is attached or removed.
Upvotes: 2