2013年11月9日土曜日

Vixie cronの思わぬ仕様の件 on FreeBSD

以前にも何月何日までcrontabで指定したら無視された経験があって、今日もやってしまい痛い目にあったので、調べてみたら仕様だった。ソースを見てもすぐにはわからずgoogleしたらFedoraか何かのバグ票で仕様だと説明が。。。

例えば11月22日(金)の23:45を以下のように指定すると、foo.shは金曜日と22日の両方で23:45に実行されるらしい。
45 23 22 11 5 foo.sh

以下がmanでの説明。
     Note: The day of a command's execution can be specified by two fields --
     day of month, and day of week.  If both fields are restricted (ie, are
     not *), the command will be run when either field matches the current
     time.  For example, ``30 4 1,15 * 5'' would cause a command to be run at
     4:30 am on the 1st and 15th of each month, plus every Friday.

きっと有名な仕様なんだろうなぁ。知らんかった。。

0 件のコメント:

コメントを投稿