<systemctl, Linux> systemctl
systemctl
、、、Linux
でサービスを起動するとか、ごちょごちょするときに使うコマンド。
>systemctl start hage.service # サービス起動 >systemctl stop hage.service # サービス停止 >systemctl restart hage.service # サービス再起動 >systemctl reload hage.service # サービスリロード >systemctl status hage.service # サービスステータス表示 >systemctl enable hage.service # サービス自動起動有効 >systemctl disable hage.service # サービス自動起動無効 >systemctl is-enabled hage.service # サービス自動起動設定確認 >systemctl list-units --type=service # 起動中のサービス一覧 >systemctl list-unit-files --type=service # 定義されているサービス一覧 >systemctl daemon-reload # 設定ファイルの再読込
>ls /usr/lib/systemd/system/*.service # 全てのサービスの設定ファイル >ls /etc/systemd/system/*.wants # ランレベルに応じたディレクトリ >ls /etc/systemd/system/multi-user.target.wants/ # ランレベル3のディレクトリと、そこにあるサービス
ログ、、、
>journalctl -u sshd # 特定のサービスのログを確認 >journalctl -f -u sshd # 特定のサービスのログを確認 + tail -f >journalctl -k # dmesgの代わり >journalctl -o JSON sshd # JSONで取得