Reputation: 6810
sudo: no tty present and no askpass program specified
Hi I am getting the above error when ever I try to get the following crontab to run.
*/5 * * * * sudo bash /home/admin/scripts/monitor.sh /dev/null 2>&1
I am using nano as the editor to edit the admin user crontab - note this is not root user.
EDITOR=nano crontab -e -u admin
Upvotes: 2
Views: 2676
Reputation: 464
1) Disable requiretty in sudoers file
2) Permit script execution without password:
admin ALL=(ALL) NOPASSWD: /home/admin/scripts/monitor.sh
3) I'm not sure but you don't need specify bash after sudo. Just add #! /bin/bash at the begin of the script
*/5 * * * * sudo /home/admin/scripts/monitor.sh /dev/null 2>&1
Upvotes: 3