centos crontab用法詳解 定時任務的設置

crontab 是用來讓使用者在固定時間或固定間隔執行程序之用,相似於windows的計劃任務php

安裝:
yum -y install vixie-cron
yum -y install crontabs
1
2
啓動、關閉、重啓:
/sbin/service crond start #啓動服務
/sbin/service crond stop #關閉服務
/sbin/service crond restart #重啓服務
/sbin/service crond reload #從新載入配置
1
2
3
4
簡單操做:
#列出crontab任務
crontab -lhtml

#編輯crontab任務
crontab -ewindows

#刪除crontab任務
crontab -r
1
2
3
4
5
6
7
8
編輯任務例子:
每隔20分鐘調用php解釋器執行一次test.php文件:rest

*/20 * * * * /usr/bin/php /var/www/html/test.php
1
詳解:
* *  *  *  *   .........
分  時 日 月 周  命令htm

相關文章
相關標籤/搜索