84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
crontab 每3个小时运行一次
3/ sh /home/test.sh
这种情况,我保存时在8点,那么9点就会运行吗?他这个每3个小时,是 什么时间点 的3个小时???
学习是最好的投资!
m h dom mon dow command
This is what is displayed when you open crontab, please explain
m:分钟,0-59 h:小时,0-23 dom:日期,1-31 mon:月份,1-12 dow:星期,0-6,0为星期天 command:命令
The first one represents the minute, so you can just write the first one to indicate the minute to execute it
All you have to do is limit the second parameter, hours
1 */3 * * * php /path/to/your/cron.php 每隔3小时的第一分钟执行一次任务
How do you understand the word "every" here? */1和*无区别,所以可以省略。这里可以想想,*/3It’s easier to understand if it means a time divisible by 3.
*/1
*
*/3
I blogged about it before, you can take a look: Using Crontab to execute PHP files regularly under Ubuntu
$ crontab -e 1 */3 * * * commands
This is executed every 3 hours. You can test it by yourself on how to execute it. For example, echotime to a file
echo
This is what is displayed when you open crontab, please explain
The first one represents the minute, so you can just write the first one to indicate the minute to execute it
All you have to do is limit the second parameter, hours
How do you understand the word "every" here?
*/1
和*
无区别,所以可以省略。这里可以想想,*/3
It’s easier to understand if it means a time divisible by 3.I blogged about it before, you can take a look: Using Crontab to execute PHP files regularly under Ubuntu
This is executed every 3 hours. You can test it by yourself on how to execute it. For example,
echo
time to a file