云服务器 ECS Linux Crontab 执行 PHP 程序失败
*/1 * * * * /opt/lampp/htdocs/demon monitor >> /tmp/crontab/monitor.log
查看 /tmp/crontab/monitor.log 为空
$ ll -sh
0 -rwxrwxrwx 1 root root 0 8月 11 07:58 monitor.log
查看crontab日志,正常执行了
Aug 11 07:37:01 iZ25v3bf76fZ CROND[1914]: (root) CMD (/opt/lampp/htdocs/demon monitor >> /tmp/crontab/monitor.log)
Aug 11 07:37:01 iZ25v3bf76fZ CROND[1923]: (root) CMD (/opt/lampp/htdocs/demon monitor >> /tmp/crontab/monitor.log)
单独直接执行程序正常
$ /opt/lampp/htdocs/demon monitor >> /tmp/crontab/monitor.log
$ ll -sh
4.0K -rwxrwxrwx 1 root root 1.9K 8月 11 08:00 monitor.log
参考这个教程https://help.aliyun.com/knowledge_detail/42499.html