3

I've created the file bellow

$ cat /etc/udev/rules.d/10-tuned.rules 
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_STATUS}=="Charging", RUN+="touch /home/fx/charg"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_STATUS}=="Discharging", RUN+="touch /home/fx/disc"

but if I connect or disconnect the power cable no files created. After creating this file I did execute

sudo udevadm control --reload-rules

for rules reloading. What I did wrong?

1 Answer 1

6

I changed touch to /usr/bin/touch and it worked. The full path of executables is needed for the RUN directive (otherwise the executable must be in /lib/udev):

SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_STATUS}=="Charging", RUN+="/usr/bin/touch /home/fx/charg"
SUBSYSTEM=="power_supply", ENV{POWER_SUPPLY_STATUS}=="Discharging", RUN+="/usr/bin/touch /home/fx/disc"
1
  • @Sneetsher Thank you for reminding. I accepted it. Jul 14, 2015 at 10:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .