且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

crontab运行shell脚本报sudo错误

更新时间:2022-09-15 17:27:39

报错:

sudo:sorry, you must have a tty to run sudo.


在shell脚本调用perl之前加上sudo,shell脚本单独执行是没有错误的。


解决crontab问题:


chmod 640 /etc/sudoers

sudo vim /etc/sudoers

注释掉: Defaults requiretty。










本文转自 yntmdr 51CTO博客,原文链接:http://blog.51cto.com/yntmdr/1828665,如需转载请自行联系原作者