要設定 cron , 可以使用 crontab 這個指令
crontab [-u user] [-l | -e | -r]
參數說明 :
-u user :只有 root 能下達的參數,視察或編譯其他使用者的 crontab 內容
-l :列出 crontab 的內容
-e :編輯 crontab 的內容
-r :刪除 crontab 的內容
使用 crontab -e 進入編輯模式 , 可以看到類似以下的文字 :
0 12 * * 0 root ntpdate watch.stdtime.gov.tw
代表的意義是 => 每個星期天的 12:00 用 root 身分執行 ntpdate ... 的指令
詳細說明 :
| 分 | 時 | 日 | 月 | 星期 | 身分 | 要執行的指令 |
| 0 | 12 | * | * | 0 | root | ntpdate watch.stdtime.gov.tw |
星期為 0 代表星期天
* 號代表任何時候
使用 crontab -e 是設定個人自己的 "例行性工作"
如果要變更系統用的 "例行性工作" , 那就得要去修改 /etc/crontab 這個檔案了 , 其格式跟上面的說明一樣
沒有留言:
張貼留言