RHEL9 SYSTEMCTL によるシステムサービス管理方法

環境
Red Hat Enterprise Linux release 9.2 (Plow)

概要
システム管理者は、systemctl ユーティリティーを使用してシステムサービスを管理できます。

操作手順
1.現在ロードされているすべてのサービスユニットをリストします。
# systemctl list-units –type service

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
結果
# systemctl list-units --type service
UNIT LOAD ACTIVE SUB DESCRIPTION >
accounts-daemon.service loaded active running Accounts Service
alsa-state.service loaded active running Manage Sound Card St>
atd.service loaded active running Deferred execution s>
auditd.service loaded active running Security Auditing Se>
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD St>
bluetooth.service loaded active running Bluetooth service
chronyd.service loaded active running NTP client/server
colord.service loaded active running Manage, Install and >
crond.service loaded active running Command Scheduler
cups.service loaded active running CUPS Scheduler
dbus-broker.service loaded active running D-Bus System Message>
dracut-shutdown.service loaded active exited Restore /run/initram>
firewalld.service loaded active running firewalld - dynamic >
gdm.service loaded active running GNOME Display Manager
irqbalance.service loaded active running irqbalance daemon
kdump.service loaded active exited Crash recovery kerne>
kmod-static-nodes.service loaded active exited Create List of Stati>
libstoragemgmt.service loaded active running libstoragemgmt plug->
lvm2-monitor.service loaded active exited Monitoring of LVM2 m>
mcelog.service loaded active running Machine Check Except>
ModemManager.service loaded active running Modem Manager
NetworkManager-wait-online.service loaded active exited Network Manager Wait>
結果 # systemctl list-units --type service UNIT LOAD ACTIVE SUB DESCRIPTION > accounts-daemon.service loaded active running Accounts Service alsa-state.service loaded active running Manage Sound Card St> atd.service loaded active running Deferred execution s> auditd.service loaded active running Security Auditing Se> avahi-daemon.service loaded active running Avahi mDNS/DNS-SD St> bluetooth.service loaded active running Bluetooth service chronyd.service loaded active running NTP client/server colord.service loaded active running Manage, Install and > crond.service loaded active running Command Scheduler cups.service loaded active running CUPS Scheduler dbus-broker.service loaded active running D-Bus System Message> dracut-shutdown.service loaded active exited Restore /run/initram> firewalld.service loaded active running firewalld - dynamic > gdm.service loaded active running GNOME Display Manager irqbalance.service loaded active running irqbalance daemon kdump.service loaded active exited Crash recovery kerne> kmod-static-nodes.service loaded active exited Create List of Stati> libstoragemgmt.service loaded active running libstoragemgmt plug-> lvm2-monitor.service loaded active exited Monitoring of LVM2 m> mcelog.service loaded active running Machine Check Except> ModemManager.service loaded active running Modem Manager NetworkManager-wait-online.service loaded active exited Network Manager Wait>
結果
#  systemctl list-units --type service
  UNIT                               LOAD   ACTIVE SUB     DESCRIPTION         >
  accounts-daemon.service            loaded active running Accounts Service
  alsa-state.service                 loaded active running Manage Sound Card St>
  atd.service                        loaded active running Deferred execution s>
  auditd.service                     loaded active running Security Auditing Se>
  avahi-daemon.service               loaded active running Avahi mDNS/DNS-SD St>
  bluetooth.service                  loaded active running Bluetooth service
  chronyd.service                    loaded active running NTP client/server
  colord.service                     loaded active running Manage, Install and >
  crond.service                      loaded active running Command Scheduler
  cups.service                       loaded active running CUPS Scheduler
  dbus-broker.service                loaded active running D-Bus System Message>
  dracut-shutdown.service            loaded active exited  Restore /run/initram>
  firewalld.service                  loaded active running firewalld - dynamic >
  gdm.service                        loaded active running GNOME Display Manager
  irqbalance.service                 loaded active running irqbalance daemon
  kdump.service                      loaded active exited  Crash recovery kerne>
  kmod-static-nodes.service          loaded active exited  Create List of Stati>
  libstoragemgmt.service             loaded active running libstoragemgmt plug->
  lvm2-monitor.service               loaded active exited  Monitoring of LVM2 m>
  mcelog.service                     loaded active running Machine Check Except>
  ModemManager.service               loaded active running Modem Manager
  NetworkManager-wait-online.service loaded active exited  Network Manager Wait>

デフォルトでは、systemctl list-units コマンドは、アクティブなユニットのみを表示します。
このコマンドは、サービスユニットファイルごとに、次のパラメーターの概要を提供します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
UNIT
サービスユニットのフルネーム
LOAD
設定ファイルのロード状態
ACTIVE またはSUB
現在の高レベルおよび低レベルのユニットファイルのアクティベーション状態
DESCRIPTION
ユニットの目的と機能の簡単な説明
UNIT サービスユニットのフルネーム LOAD 設定ファイルのロード状態 ACTIVE またはSUB 現在の高レベルおよび低レベルのユニットファイルのアクティベーション状態 DESCRIPTION ユニットの目的と機能の簡単な説明
UNIT
サービスユニットのフルネーム
LOAD
設定ファイルのロード状態
ACTIVE またはSUB
現在の高レベルおよび低レベルのユニットファイルのアクティベーション状態
DESCRIPTION
ユニットの目的と機能の簡単な説明

2.–all または -a コマンドラインオプションを指定して次のコマンドを使用し、ロードされたすべ
てのユニットを状態に関係なく をリスト表示します。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
$ systemctl list-units --type service --all
$ systemctl list-units --type service --all
$ systemctl list-units --type service --all

3.利用可能なすべてのサービスユニットのステータス (enabled または disabled) をリスト表示し
ます。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl list-unit-files --type service
# systemctl list-unit-files --type service
# systemctl list-unit-files --type service

 

IT

Posted by arkgame