systemctl status <service-name> ※サービスの稼働状況を表示 systemctl is-active <service-name> ※サービスが稼働中か表示
状態 | 説明 |
Loaded | プロセスが起動している状態 |
Active(running) | プロセスが実行中 |
Active(exited) | プロセスの起動が終了 |
Active(waiting) | イベントの発生を待機中 |
Inactive | 起動していない |
Enabled | 自動起動がON |
Disabled | 自動起動がOFF |
systemctl is-enabled <service-name> ※自動起動の設定を表示 systemctl enable <service-name> ※自動起動ON systemctl disable <service-name> ※自動起動OFF systemctl preset <service-name> ※自動起動ONまたはOFF(プリセットポリシーに従う)
ls -l /etc/systemd/system/multi-user.target.wants/ ※自動起動を有効にするとここにサービスのシンボリックリンクが作成される
systemctl start <service-name> ※起動 systemctl stop <service-name> ※停止 systemctl restart <service-name> ※再起動 systemctl reload <service-name> ※サービスの設定を再読み込み
systemctl list-dependencies ※Unitの依存関係を表示 systemctl list-dependencies <service-name> ※Unitの依存関係を表示 systemctl list-units ※起動している全てのUnitの状態を表示 systemctl list-unit-files ※全てのUnitを表示 systemctl list-unit-files -t service ※サービスの一覧を表示 systemctl list-unit-files -t service --state=enabled ※サービスの一覧を表示(自動起動が有効のみ)
systemctl mask <service-name> ※マスク有効 systemctl unmask <service-name> ※マスク解除
systemctl poweroff ※システムを停止 systemctl reboot ※システムを再起動
systemctl daemon-reload
systemctl get-default
systemctl set-default <target-name>
systemctl isolate rescue.target ※シングルユーザーモード systemctl isolate multi-user.target ※マルチユーザーモード systemctl isolate emergency.target ※緊急モード
ls -l /etc/systemd/system/default.target →default.targetのリンク先で確認する →multi-user.target であればマルチユーザ