taktran / rpi-leds

Node.js library to control Raspberry Pi onboard LEDs
10 stars 1 forks source link

sudo and auth.log #7

Open Ciao121 opened 1 year ago

Ciao121 commented 1 year ago

Using this module like leds.power.turnOff() or any other command in a node script running as root I get those lines in auth.log file:

sudo:     root : PWD=/ ; USER=root ; COMMAND=/usr/bin/tee /sys/class/leds/led0/brightness
Dec 27 09:14:52 myhost sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Dec 27 09:14:52 myhostsudo: pam_unix(sudo:session): session closed for user root

I'm using turnOff and turnOff thousand of times and the logfile become enourmous. How to workaround this? Thanks!!!!

Ciao121 commented 1 year ago

A good solution IMHO is to test (at first run) if a led command can be executed without using sudo and using it only if the test is unsuccesfull. I'm not good enough to code it well so it's a suggestion if someoune would do it... As a workaroud I forked the repository and changed it to not using sudo at all.