Run command after mount / unmout usb drive

I have a Raspberry Pi (with Raspbian) and use it as a DLNA / UPnP server and visualization tool. I am running minidlna as a DLNA server, and I have some media files on USB.

I would like to automate DLNA DB recovery when the drive is mounted and unmounted. This is done by the command:

sudo service minidlna force-reload

What is the way to autostart this command?

BTW I am using the "USBmount" package for automount USB drives.

Thanx

+4
source share
2 answers

, usbmount. , mount/umount /etc/usbmount/mount.d//etc/usbmount/umount.d/.

+5

lsusb. (, 12f5: a91a)

udev /etc/udev/rules.d/, ,/etc/udev/rules.d/100-my-mount.rules , :

ACTION=="add", ATTRS{idVendor}=="12f5", ATTRS{idProduct}=="a91a", RUN+="/home/your_username/bin/my-mount-script.sh"

ACTION == "remove" script.

+2

All Articles