1. 程式人生 > >crontab定時任務

crontab定時任務

roo 刪除 rontab port .py 絕對路徑 n) for 使用

crontab -e

0 4 * * * /root/scripts/mysqlbackup.sh

0 4 * * * /root/scripts/apacherestart.sh

0 5 * * 1,3,5 /usr/bin/python /home/report/report_form.py 每周一、周三、周五早上五點執行python腳本report_form.py

python需要知名絕對路徑(使用命令which python)

crontab –e : 修改 crontab 文件. 如果文件不存在會自動創建。

crontab –l : 顯示 crontab 文件。

crontab -r : 刪除 crontab 文件。

crontab -ir : 刪除 crontab 文件前提醒用戶。

*註意:不希望執行某個定時任務,只需要把crontab -e裏面的那行刪除掉就可以

crontab定時任務