LoginSignup
0
0

More than 1 year has passed since last update.

RockyLinux8 vps環境設定4) 時間設定の変更

Last updated at Posted at 2022-09-17

RockyLinux8 vps環境設定3) 他のサーバとのssh接続
https://qiita.com/naga_kt/items/f887ee7f71453ac25255
の続き。WebArena Indigo(RockyLinux8.4)及びKagoya(RockyLinux8.5)での環境設定について述べる。

 Kagoya(RockyLinux8.5)では、デフォルトがJST時間である。
 
 WebArena Indigo(RockyLinux8.4)では、デフォルト設定のままではUTC時間である。

$date
Wed Dec 15 23:42:06 UTC 2021

 不便なのでJSTに変えておく。
 ここでUTC時間なのはdateだけでなくて、cronもUTC時間で動いている。同時に変える必要がある。

タイムゾーンの変更

 時間設定の変更は以下のようにして行なう。/etc/localtimeのリンク先を変えることで、タイムゾーンを変更すればいい。

#cd /etc/
#ls -lrt localtime
lrwxrwxrwx. 1 root root 25 Oct  5  2018 localtime -> ../usr/share/zoneinfo/UTC
#ln -sf  /usr/share/zoneinfo/Asia/Tokyo localtime
#ls -lrt localtime
lrwxrwxrwx. 1 root root 30 Dec 16 08:54 localtime -> /usr/share/zoneinfo/Asia/Tokyo
#date
Thu Dec 16 08:54:29 JST 2021

cronの時間設定の変更

 以下も行なってcornの時間設定も変更する。

#service crond restart
Redirecting to /bin/systemctl restart crond.service
#service rsyslog restart
Redirecting to /bin/systemctl restart rsyslog.service

 cronのログは/var/log/cronに吐き出されているが、crondだけでなく、rsyslogも再起動することで、ログにJSTで吐き出されるのを確認することができる。


RockyLinux8 vps環境設定5) Swapの設定
https://qiita.com/naga_kt/items/a8649ea8da7303a7e6a6
に続く。


参考記事

CentOS
Amazon Linuxでタイムゾーンを変更してcronの実行時刻にも反映させる
https://qiita.com/owlbeck/items/b8379971890edb755cac

CentOS
Cronがutcで動いてる場合に
http://yoshitsugufujii.github.io/blog/2016/02/03/change-crons-timezone/

0
0
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
0
0