systemctl を利用した intdash サービスの管理(インフラ管理者向け)

インスタンスで稼働する intdash の各種サービスは systemctl というシステムマネージャーソフトウェアで管理しています。

以下では、systemctl を使用した intdash の各種サービスの状態管理方法を記載します。

systemctl を利用したサービスの状態管理

以下のコマンドを使用して、intdash 各サービスの状態を管理することができます。

コマンド 管理内容
systemctl start <サービス名> サービスの起動
systemctl stop <サービス名> サービスの停止
systemctl restart <サービス名> サービスの再起動
systemctl status <サービス名> サービスの現在の状態
systemctl list-unit-files systemctl で管理しているサービス一覧(※1)

(※1 intdashのサービス以外も表示されます。)

intdashを構成するサービスの一覧については、intdashサーバーを構成するサービスの一覧(インフラ管理者向け) を参照してください。

systemctl が参照する設定ファイル

systemctl コマンドによるサービスの起動や停止は、設定ファイル(ユニットファイルとも呼びます)内に指定されているコマンドにより行われます。intdash の各サービスの設定ファイルは以下に配置されています。

/etc/systemd/system/multi-user.target.wants

例えば、intdash-apiサービスの設定ファイルは、以下のようになっています。

$ cat  /etc/systemd/system/multi-user.target.wants/intdash-api.service

[Unit]
Description=intdash API Server
After=network.target

[Service]
User=intdash
Group=intdash
Type=simple
ExecStart=/usr/bin/intdashd serve -c /etc/intdash/intdashd.conf
KillMode=process
Restart=on-failure
RestartSec=30s

[Install]
WantedBy=multi-user.target

systemctl start intdash-api のコマンドを実行した場合、実際には上記の ExecStartで指定しているコマンドが実行されることになります。

設定ファイルの変更と反映

設定ファイルはテキストファイルであるため、必要に応じてテキストエディターを使って変更することができます。

設定ファイルを変更した場合は、その後 systemctl で再読み込みさせるため、以下のコマンドを実行してください。

# systemctl daemon-reload

これにより、設定ファイルの再読み込みが行われます。