沒想到Crontab還可以這樣寫!
Crontab一般的格式是
18 10 5 * * * root /usr/sbin/ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w對應到
m h dom mon dow user command不過還有另一種寫法 ex:
field allowed values
----- --------------
minute 0-59
hour 0-23
day of month 1-31
month 1-12 (or names, see below)
day of week 0-7 (0 or 7 is Sun, or use names)
@hourly root /usr/sbin/ntpdate tock.stdtime.gov.tw && /sbin/hwclock -w說明如下 :p
string meaning詳細的資訊可以 man 5 crontab
------ -------
@reboot Run once, at startup.
@yearly Run once a year, "0 0 1 1 *".
@annually (same as @yearly)
@monthly Run once a month, "0 0 1 * *".
@weekly Run once a week, "0 0 * * 0".
@daily Run once a day, "0 0 * * *".
@midnight (same as @daily)
@hourly Run once an hour, "0 * * * *".