Sample Header Ad - 728x90

Udev rule not executing script correctly

0 votes
0 answers
348 views
I have a udev rule 80-wacom.rules
SUBSYSTEM=="usb", ACTION=="add", RUN+="/usr/local/bin/wacom.sh"
My understanding is that it will run wacom.sh whenever any USB device is plugged in. I verified that it was indeed triggering by logging the time of execution in a file.
#!/bin/bash

    /usr/bin/date >> /tmp/udev.log;
    /usr/bin/xsetwacom set /usr/bin/xsetwacom --list |grep -i stylus |awk {'print $6'} MapToOutput HEAD-0;
    /usr/bin/xsetwacom set /usr/bin/xsetwacom --list |grep -i eraser |awk {'print $6'} MapToOutput HEAD-0
I have verified that it is writing the timestamp to the log file whenever a device is plugged in, but the crucial other two lines of code are not executing. When I execute the script directly, the timestamp appears in the log file, and the other two lines of code execute as expected. So the udev rule runs. The script runs. But the script as run by the udev rule does not perform as expected. I have tried adding a delay at the start of the script, but this does not resolve the issue. I am at my wit's end. Any insight would be enormously appreciated.
Asked by Soren Brandt (1 rep)
Aug 25, 2019, 08:17 AM