LoginSignup
1
1

More than 3 years have passed since last update.

今更ながらLinuxのsystemctlコマンドで使うやつをまとめ

Posted at

今更ながらserviceコマンドとの違いも含めてまとめ

サービスの一覧

3種類ある。ふだん使うのはlist-unit-filesか。

コマンド 用途
systemctl list-units 管理しているサービスユニットの状態一覧。
systemctl list-sockets 管理しているサービスのソケット一覧 
systemctl list-unit-files 管理しているサービスのファイル一覧 

開始・停止の基本

コマンド 用途
systemctl start [target] サービス開始
systemctl stop [target] サービス停止 
systemctl reload [target] サービス設定リロード
systemctl restart [target] サービス再起動

開始・停止の拡張

コマンド 用途
systemctl try-restart [target] サービスの再起動を試みる。
systemctl reload-or-restart [target] サービスの設定リロードを試みてうまくいかなかったら再起動する。 
systemctl reload-or-try-restart [target] サービスの設定リロードを試みてうまくいかなかったら再起動する。
systemctl kill [target] サービスkill

サービスに追加・削除・確認

コマンド 用途
systemctl enable [target] サービス有効化。
systemctl disable [target] サービス無効化。 
1
1
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
1
1