I want to setup notification whenever any network drive is mounted or unmounted. (Basically I want to run a custom script, whenever any network storage is mounted or unmounted). I think udev can do this, but I don't know how to write udev rule for such a task.
When I mount a network share using the following command:
sudo mount -t cifs -o username=user,password=pwd //ipaddr/sharename mountpoint
the filesystem is successfully mounted I can see the following
sysfs entries were created:
/sys/class/bdi/cifs-<num>/ & /sys/devices/virtual/bdi/cifs-<num>
udev monitor such a change? If yes, how does the rule look like?
Or is there some other method to do this?
Any help appreciated.