5

I have cron jobs in cPanel that are scheduled every night. Yesterday, I noticed that these cron jobs haven't run since 2 days ago. I checked the cron log in /var/log/cron, and it shows me errors when trying to access the file.

Errors:

Nov  6 11:25:01 web2 crond[17439]: (laptoplc) ERROR (failed to change user)
Nov  6 11:25:01 web2 crond[17447]: (projecto) ERROR (failed to change user)
Nov  6 11:25:01 web2 crond[17446]: (CRON) ERROR (setreuid failed): Resource temporarily unavailable
Nov  6 11:25:01 web2 crond[17446]: (laptoppa) ERROR (failed to change user)

What could be the problem?

4

3 回答 3

6

可能有几件事导致了这种情况。以下是调试 crons 的方法:

  1. 从 shell 手动运行它:

    php yourcron.php

  2. 从您的 cron 文件添加日志记录,可能通过添加 error_log('check if running'); 看看它是否确实在运行。

如上所述,它也可能是权限问题。为您的 cron 添加执行权限:

chmod 755 yourcron.php
于 2013-11-13T14:13:11.257 回答
1

使用以下命令检查这些用户是否存在任何 Zombie 进程。

ps -eLF |grep -i username

尝试杀死这些进程并检查 cronjobs 之后是否正在运行。

sudo ps -eLF |grep username |awk '{print $2}' |xargs sudo kill -9 

不要杀死任何重要的运行进程!

于 2013-11-26T22:18:18.157 回答
-1

我今天遇到了类似的问题。/var/spool/cron/userXXX 中的 cron 有一个 /home/userYYY(另一个用户)的脚本,因此发生了这个错误。我删除了包含 userYYY 的行,这已解决。

于 2018-04-16T18:41:27.687 回答