2009年6月16日 星期二

cron.daily

設定每日定時執行特定程式
在 /etc/cron.daily 目錄內,新增一檔案 ntp ,

編輯內容為:
ntpdate -s clock.stdtime.gov.tw
hwclock -w

chmod 755 ntp
將檔案權限設為755,讓cron每天會自動執行位於/etc/cron.daily下的所有指令(scripts)

crontab 的格式如下:
分 時 日 月 星期 要執行的指令
exsample:
30 12 * * * /usr/sbin/rm xxx.txt(絕對路徑)
在 12:30 時將 xxx.txt 這個檔案殺掉
* 號表示每日每月每星期都執行

沒有留言:

張貼留言