Http://www.phpddt.com/php/linux-crontab.html
Crontab
Yum Installcrontabs //installation instructions:/sbin/service Crond Start//Start the service/sbin/service Crond Stop//Close Service/sbin/service Crond Restart//Restart Service/sbin/service Crond Reload//Reload Configuration View crontab Service Status:crond status manual start crontab Service: Servicescrond start To see if the Crontab service is set to boot, execute the command:ntsysv //Not successfully added to boot automatically: chkconfig–level *Crond on
Crontab Task Command:
crontab [-u < user name >][profile] or crontab [-u < user name >][-ELR]-e Edit the user's timer settings. -L lists the user's timer settings. -R removes the user's timer settings. -u< User name > Specifies the user name to set the timer.
Contab format
Minute Hour Day Month DayOFWeek Command
Example:
1. Create a PHP file to execute
#!/usr/local/php/bin/php-<? PHP Echo Date ('y-m-d h:i:s'). " from http://www.phpddt.com \ n " ;? >
2. Settings can be performed
chmod +x test.php
3, Crontab-e writing
* * * * * */root/test.php >> Test.log
This step can be written on the PHP path, you do not need 1, 2 steps
/usr/bin/php -f/root/test.php >> test.log
4. View Results
Vim/root/test.log
Http://www.jb51.net/article/29136.htm
Use URL to execute script in crontab:
Use curl to access the URL to execute PHP scripts every 5 minutes. Curl defaults to show output in standard output. With the "curl-o" option, you can also dump the output of the script to a temporary file.
*/5 * * * */usr/bin/curl-o temp.txt http://
Use the wget access URL to execute PHP scripts every 10 minutes. The-q option indicates quiet mode. "-O Temp.txt" indicates that the output is sent to a temporary file.
* * * * * * */usr/bin/wget -q-o temp.txt http://
Linux uses crontab to implement timed tasks for PHP