Crontab suddenly stop working on server?

自作多情 提交于 2020-08-08 13:19:06

问题


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.

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.

New cron i have add look like that:

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

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

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


回答1:


Maybe it is off, you can turn it on with this command

service crond start



回答2:


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.

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

[abc@host] crontab -e

and save crontab :wq!

Now set permission for script

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

Now restart your crontab.(in RHEL like below)

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


来源:https://stackoverflow.com/questions/28493042/crontab-suddenly-stop-working-on-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!