19
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Rundeckで登録したジョブを月初に自動実行したい

19
Last updated at Posted at 2019-05-10

タイトルのことをやりたくて、
Rundeckのcron設定で詰まったので、
解決方法のメモです。

手順

まずはスケジュール設定を行います。
Edit JobのSchedule to run repeatedly?でCrontabを選択すると、
ジョブ繰り返し実行のスケジュール設定を行うことが出来ます。

Crontab形式での指定は、通常のCrontabの設定とは異なり
Rundeckで拡張されています。

具体的にどうなっているかというと、
[Seconds][Minute][Hour][DayOfMonth][Month][DayOfWeek][Year]
秒 分 時 日 月 曜 年

秒と年が追加されています。

月初の1時0分なのでcronの要領で、
0 0 1 1 * * *
と入力します。

これをrundeck上で確認すると、

0 0 1 ? * * *

なぜ...

調べてみると、

疑問符は特定の値がないことを示す。
この文字を入力できる 2つのフィールドの一方に何か指定する必要があるが、
もう一方には指定する必要がない場合適用される。

ということらしいので、
Rindeckが*のすべての曜日選択を毎日と解釈されて、

Schedule : at 1:00 every day

となってしまうらしい...。

解決させるには、

0 0 1 1 * ? *

に変更。

確認すると、

Schedule : at 1:00 day 1

Rundeckのcronは特殊で戸惑いましたが、
解決出来ました。

参考

19
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
19
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?