4

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 abc@live.com -s smtp.live.com:587 -m "USB Attached" -o username=xyz@live.com
user115079
  • 711
  • 1
  • 11
  • 23

1 Answers1

2

I found the way by using udevadm monitor --environment. This gives complete details when a USB device is attached or removed.

user.dz
  • 962
  • 2
  • 19
  • 39
user115079
  • 711
  • 1
  • 11
  • 23