Crontab突然停止在服务器上工作? [英] Crontab suddenly stop working on server?

查看:400
本文介绍了Crontab突然停止在服务器上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Linux平台上的服务器上设置了一些crontab。在这2天之前,所有cron都在运行。我不知道crontab会发生什么事情,因为它们现在无法工作。

I have some crontab set on server on linux platform.Before that 2 days all the cron was running.I dont know what happen with crontab that they are not working now.

所有cron之前都已运行,并且在它们未运行之后我添加了新的crontab,这可能是问题所在,还是还有其他问题。

All the cron was running before and i have added a new crontab after that they are not running may be this is the problem or is there other problem with that.

我已经检查了他们的许可,但是没关系。

I have check ther permission but that is ok with.

我添加的新cron看起来像这样:

New cron i have add look like that:

*/15 * * * * php myproject/sendmail.php
30 5 * * * php myproject/sendmailOnDiscount.php
* */1 * * * php myproject/sendInvitaion.php

最后一个已添加,然后另一个运行良好。
添加crontab sendInvitation.php后crontab已停止工作。

The last one have added and before that other was running well. After adding crontab sendInvitation.php crontab has stop working.

谁能告诉我为什么crontab现在不工作(所有crontab都停止工作了)。

Could any one tell me why crontab is not working now.(All the crontab has stop working)

推荐答案

大多数情况下,此问题是由于脚本文件的许可和脚本文件的所有权而发生的。我也面临着同样的问题。我发现我的脚本所有者不是超级用户,例如

Mostly this problem occurs due to script file permission and ownership of script files. The same problem was faced by me. I found that my script owner was not a super user e.g. root.

因此,您必须将脚本的权限和所有权设置为超级用户。在下面找到。

So, you have to set the permission and ownership of your scrip as super user. Find below.

首先以超级用户身份编辑crontab。(在RHEL中,如下所示)

First of all edit your crontab as super user.(in RHEL like below)

[abc@host] crontab -e

并保存crontab:wq !

and save crontab :wq!

现在为脚本设置权限

[abc@host] chmod +x script.sh
[abc@host] chown root:root script.sh

现在重新启动crontab。(在RHEL中,如下所示)

Now restart your crontab.(in RHEL like below)

[abc@host] /etc/init.d/crond restart

这篇关于Crontab突然停止在服务器上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆