简体   繁体   English

如何在Cpanel每天6点钟完成cron工作

[英]how to make cron job every day at 6 O'clock by Cpanel

how to make cron job every day at 6 O'clock by Cpanel ? 如何在Cpanel每天6点钟完成cron工作? I added cron job by my cpanel as this picture 我在我的cpanel中添加了cron job作为这张图片

http://i.imgur.com/vc1iv.jpg http://i.imgur.com/vc1iv.jpg

But the script work more one time in the day , I need to know the error in cron or in my script . 但是脚本在一天中工作的次数更多,我需要知道cron或我脚本中的错误。

Your cron will run every minute at 6 o'clock, because of that asterisk. 由于那个星号,你的cron将在每分钟6点运行。

Cron format : Cron格式

* * * * * *
| | | | | | 
| | | | | +-- Year              (range: 1900-3000)
| | | | +---- Day of the Week   (range: 1-7, 1 standing for Monday)
| | | +------ Month of the Year (range: 1-12)
| | +-------- Day of the Month  (range: 1-31)
| +---------- Hour              (range: 0-23)
+------------ Minute            (range: 0-59)
Any of these 6 fields may be an asterisk (*). 
This would mean the entire range of possible values, i.e. each minute, each hour, etc.

You should put minute 0 because you need to run it just once (at 06:00). 你应该把分钟0,因为你只需要运行一次(在06:00)。

0 6 * * * 

You should change your cronjob like following: 你应该改变你的cronjob如下:

0 6 * * * /usr/bin/php and so on

In this way it will run at 6 o'clock. 这样它将在6点钟运行。 In your way, it will start running at 6 and then it will run again every minute for an hour. 在你的方式,它将开始在6运行,然后它将每分钟再运行一个小时。

As example, if you want a script to run on the 3rd day of the month at midnight, you should write: 例如,如果您希望脚本在午夜的第3天运行,您应该写:

0 0 3 * * /usr/bin/php and so on

If you leave asterisk on the first two field, it will run for the whole day. 如果您在前两个字段上留下星号,它将运行一整天。

Have a look to the man page . 看一下手册页 Some example can be very useful, ie the one with @daily macro. 一些例子非常有用,即带有@daily宏的@daily

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM