I have a python script that reboots the device at the end of the script. I got it working fine on my user account by giving the user rights to /sbin/shutdown
in sudoers file. But the problem is that when I try to automate it with the user's crontab, I get the following error:
sudo: no tty present and no askpass program specified
Any ideas how to solve the problem? I thought the user's crontab would have same rights as the user, but it doesn't seem that way.
I can't use root crontab because part of the python script uses Selenium with geckodriver and geckodriver cannot be ran as root.
Here's the reboot part of the python script:
def restart():
command = "/usr/bin/sudo /sbin/shutdown -r now"
import subprocess
process = subprocess.Popen(command.split(), stdout=subprocess.PIPE)
output = process.communicate()[0]
print output
I'm using Ubuntu 18.10