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?

5

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"
  • @Sneetsher Thank you for reminding. I accepted it. – user2279855 Jul 14 '15 at 10:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.