28
20

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.

タイムゾーンが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で設定できます。
以上です。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?