1. 程式人生 > >關於crontab的學習總結

關於crontab的學習總結

amp tao haitao 關閉 sta 常用 學習總結 taobao test

一、常用定時任務總結:

1、每分鐘執行一次:

* * * * *

2、每小時執行一次 :

0 * * * *

二、關於 crontab 的執行方式:(只寫php和sh腳本的)

1、運行 xxx.sh

命令行:

sh xxx.sh

2、運行 xx.php

命令行:

/usr/local/bin/php /home/xx/www/console.php crontab backcountrystartcrawl >> /home/cron/log/backcountry_error.log &

3、使用 curl 運行xx.php

命令行:

/home/curl/curl/src/curl http://xx/test/Taobao/ReiStartCrawl &

三、關於簡單的sh腳本的寫法:

xx.sh

upt=`curl http://www.haitao.com/xx.php`;

upt=`php /ss/ss/xx.php`;

外部在crontab裏運行這個sh的方式:

* * * * * xx.sh

每分鐘運行這個sh腳本一次

& 表示即使程序關閉,也繼續運行這個程序。

關於crontab的學習總結