crontabで起動時にスクリプトを走らせたいとき

crontabでは、日時指定だけではなく、起動時にも何かを走らせることが出来ます。
以下、WSLの『man 5 crontab』で確認しました。

All of the `@’ commands that can appear in place of the first five fields are extensions.

Instead of the first five fields, one of eight special strings may appear:

識別子 意味
@reboot 起動時に実行
@yearly 毎年1月1日の0時0分に実行
@annually @yearlyと同じ
@monthly 毎月1日の0時0分に実行
@weekly 毎週日曜日の0時0分に実行
@daily 毎日0時0分に実行
@midnight 毎日0時0分に実行
@hourly 毎時0分に実行

使い方

行頭の『* * * * *』の代わりに、『@reboot』等を置きます。

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny