Red Hat Training
A Red Hat training course is available for RHEL 8
第14章 systemctl によるシステムサービス管理
システム管理者は、システムサービスを管理し、サービスの起動、停止、再起動、有効化、およびシステムサービスのステータスの表示など、さまざまなサービスに関連するさまざまなタスクを実行します。systemd
システムおよびサービスマネージャーと対話するには、systemctl
ユーティリティーを使用します。
14.1. システムサービスの一覧表示
現在読み込み済みのサービスユニットと、利用可能なサービスユニットのステータスをすべて一覧表示できます。
手順
現在読み込み済みのサービスユニットの一覧をすべて表示するには、次のコマンドを実行します。
$ systemctl list-units --type service UNIT LOAD ACTIVE SUB DESCRIPTION abrt-ccpp.service loaded active exited Install ABRT coredump hook abrt-oops.service loaded active running ABRT kernel log watcher abrtd.service loaded active running ABRT Automated Bug Reporting Tool ---- systemd-vconsole-setup.service loaded active exited Setup Virtual Console tog-pegasus.service loaded active running OpenPegasus CIM Server LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 46 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'
デフォルトでは、
systemctl list-units
コマンドは、アクティブなユニットのみを表示します。このコマンドは、サービスのユニットファイルごとに以下を表示します。-
UNIT
: フルネーム -
LOAD
: ユニットファイルが読み込まれているかどうかに関する情報 -
ACTIVE
またはSUB
: 高レベルかつ低レベルのユニットファイルアクティベーションの状態 -
DESCRIPTION
: 簡単な説明
-
状態に関係なく読み込み済みユニット の一覧を表示するには、コマンドラインオプション
--all
または-a
を指定して以下のコマンドを実行します。$ systemctl list-units --type service --all
利用可能なサービスユニットのステータス (enabled または disabled) を一覧表示するには、次のコマンドを実行します。
$ systemctl list-unit-files --type service UNIT FILE STATE abrt-ccpp.service enabled abrt-oops.service enabled abrtd.service enabled ... wpa_supplicant.service disabled ypbind.service disabled 208 unit files listed.
このコマンドでは、サービスユニットごとに以下を表示します。
-
UNIT FILE
: フルネーム -
STATE
: サービスユニットが有効または無効であるかどうかに関する情報
-
関連情報