Debian系などで、Europe/Berlinのようなsystem timezone識別子を1行のtextとして保持する代表的なfileを選ぶ。
適切なpathはどれか。
/etc/timezoneはDebian系などでtimezone識別子をtext保存する。すべてのdistributionが同じ方式を使うわけではない。
詳細解説
/etc/localtime変換ruleを含むzoneinfo dataまたはそのsymlinkで、単純な識別子textとは限らない。
誤り。/etc/localtimeはzoneinfo形式のdataまたはsymlinkであり、単純な識別子text fileという要件とは異なる。
/usr/share/zoneinfo多数のtimezone dataを収録するdirectoryである。
誤り。zoneinfoは多数のdata fileを持つdirectoryで、system選択値を1行textとして保持するfileではない。
/etc/locale.gen生成するlocaleの選択に使い、timezone識別子の保存先ではない。
誤り。locale.genはlocale dataの生成対象を列挙し、Europe/Berlin等のtimezone選択を記録しない。
/etc/timezone一部distributionでsystem timezone識別子をtextとして記録する。
正しい。Debian系等では/etc/timezoneにEurope/Berlinのような識別子をtextで保持する。
実際に確かめる
一時的な検証環境で実行できる例です。
if test -f /etc/timezone; then sed -n '1p' /etc/timezone; else printf '%s\n' 'not used on this distribution'; fi期待される結果
timezone識別子、またはnot used on this distribution理解のポイント
- textの識別子
- distribution差あり
- /etc/localtimeと役割を分ける
確認時の注意
- 確認環境: Linux / /etc/timezoneの読取のみ
- /etc/timezoneの採用有無はdistributionによって異なる。
基礎のおさらい
distribution差
systemd系でも/etc/timezoneを使わず、/etc/localtimeのlinkだけで管理するdistributionがある。
整合性
設定toolを使えば識別子記録とlocaltime linkを一貫して更新できるため、個別手編集より安全である。