Skip to content


php定时运行 crontab

http://www.douzhe.com/linuxtips/75.html

http://www.phpe.net/articles/370.shtml

/var/www/html/status>crontab -l
# DO NOT EDIT THIS FILE – edit the master and reinstall.
# (/tmp/crontab.XXXXDUemOk installed on Thu May 26 11:10:37 2005)
# (Cron version — $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
0 3 * * * cd /var/www/html/status/; php -q autorun.php
/var/www/html/status>

注意php的环境变量,cli运行模式时不能接受?action=new的参数。

当程序没有定时运行时,可以尝试使用完整路径
30 7 1 * * /bin/sh -c “cd /var/vh/xxx.com/htdocs/status/cron;/usr/local/bin/php -q monthlyreport.php”

Posted in LINUX, 技术.


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.