LoginSignup
27
20

More than 5 years have passed since last update.

タイムゾーンがUTCのec2でcrontabのタイムゾーンだけをJSTに変更する

Last updated at Posted at 2016-10-24

背景

サーバーのタイムゾーンはUTCで運用しているけど、crontabはJSTで運用したい。という場合の設定です。

設定するcrontabにCRON_TZを設定する

/etc/crontab
CRON_TZ=Asia/Tokyo

# 日本時間のAM2:15に実行される
15 02 * * *  something

crontabのrestart

sudo /etc/crontab restart

こうするとサーバーのタイムゾーンはUTCですが、crontabはJSTで設定できます。
以上です。

27
20
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
27
20