LoginSignup
19
17

More than 3 years have passed since last update.

ざっくりsystemctlコマンド

Last updated at Posted at 2020-02-19

systemctlとはざっくり・・・

サービスを管理するコマンド。
※nginxを起動したり、firewallの自動起動したり、一時的に止めたりとか。
主にLinuxで使われていて、CentOS7やUbuntuで使われているみたい(CentOS6以前はchkconfigコマンドらしい)。

ちなみに対象のサービス名は〜.serviceと入れても入れなくてもOK。

例 ↓はどちらも同じ
systemctl status httpd
systemctl status httpd.service

ざっくりsystemctlコマンドを即時反映、自動起動、状態確認の3つの系統に分けてメモ。

1. 即時反映系

開始
systemctl start サービス名
停止
systemctl stop サービス名
再起動
systemctl restart サービス名
リロード
systemctl reload サービス名
強制終了
systemctl kill サービス名

2. 自動起動系

サービスの自動起動を有効にする
systemctl enable サービス名

#  止まっている状態で有効にしてもサービスは止まったまま
サービスの自動起動を無効にする
systemctl disable サービス名

# 動いている状態で無効にしてもサービスは動いたまま

3. 状態確認系

サービスの状態を確認
systemctl status サービス名
サービスの詳細を確認
systemctl show サービス名
サービスの詳細を確認
systemctl show サービス名
不具合のあるサービスを確認
systemctl --failed
アクティブかどうかの確認
systemctl is-active サービス名
自動起動の設定確認
systemctl is-enabled サービス名
全サービスの一覧
systemctl list-units --all
アクティブなサービスの一覧
systemctl list-units --type=service
19
17
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
19
17