I wanted to know how to run the script after inserting the USB drive and automatically mounted Until I can run the script as soon as the device is inserted, however, the installation of the device will occur after the script shell completes the action.
You can write udev rules in /etc/udev/rules.d/and use RUNlike:
/etc/udev/rules.d/
RUN
KERNEL=="sd?1",ATTRS{serial}=="001CC27F",ACTION=="add",RUN+="/path/to/script.sh'"
Note: script.sh will run with root privileges.
You will need to listen to the corresponding D-Bus signals, notifying that the volume is mounted.
Source: https://habr.com/ru/post/1768959/More articles:wpf: How do I place elements horizontally and evenly? - layoutThe iOS device goes into standby mode, the network stops. How do I get an alert to enter an "idle" state? - iosLink counter when returning shared_ptr - c ++how to install dependency in maven not in WEB-INF / lib - mavenWhat does IsNumeric do? - sql-server-2008boost :: filesystem :: path and std :: string - c ++Stdout java program and foreground disconnect - redirectDoes the statistic mean :: The descriptive method of percentiles is documented? - statisticsSetting DropDown List Width for DataGridView ComboBoxColumn - WinForms - c #Associations with Doctrine PHP - databaseAll Articles