I need to automatically run my script /var/www/html/configWWW
when any USB is plugged in to my Rasperry.
UDEV RULE - /etc/udev/rules.d/myRule.rules
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="****",
ATTR{idProduct}=="****", RUN+="/var/www/html/configWWW"
MY SCRIPT /var/www/html/configWWW
#!/bin/bash
file="/media/pi/`ls /media/pi`/SymSif.xml"
if [ -f "$file" ]
then
(
echo "it works: $(date)" >> /home/pi/Desktop/test.txt
)
else
(
echo "it does not works: $(date)" >> /home/pi/Desktop/test.txt
)
fi
On the other hand, if i run script from bash bash /var/www/html/configWWW
, it works!
Why doesn't my udev rule work like my bash command?
udevadm control --reload-rules && udevadm trigger
reloadls
ATTRS
instead ofATTR
in the udev-rule.