Wednesday, September 20, 2017

python - How do I sudo a command in a script without being asked for a password?

I want to turn my system on automatically every day. So I use the below code in my Python script, but sudo asks me for a password every time:



os.system('sudo sh -c "echo date \'+%s\' -d \'+ \
24 hours\' > /sys/class/rtc/rtc0/wakealarm"')


How can I run this script without sudo asking for the password every time?

No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...