Linux定时任务

crontab 每分钟、每小时、每天、每周、每月、每年定时执行 

每五分钟执行  */5 * * * *

每小时执行     0 * * * *

每天执行        0 0 * * *

每周执行       0 0 * * 0

每月执行        0 0 1 * *

每年执行       0 0 1 1 *

linux定时执行url链接

使用了两种办法做计划任务,但均以失败
1.crontab -e里面写的是* * * * * /usr/bin/php http://localhost/nh/index.php/Crontab/addLevel
但是报错:Could not open input file: http://localhost/nh/index.php/Crontab/addLevel(防火墙已经关闭)
2,crontab -e 里面写的是* * * * * /usr/bin/php /home/wwwroot/default/nh/test.php 但是报错:PHP Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/default/nh/test.php:2) in /home/wwwroot/default/nh/test.php on line 3
其中第二种方法test.php为

<?php

Header("Location:http://127.0.0.1/nh/index.php/Crontab/addLevel");

 ?>

Linux定时任务,古老的榕树,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。