Ubuntu 21.04
Sponsored Link

初期設定 : サービスの管理2021/04/28

 
サービスの状態の確認や 有効化/無効化 は以下のように実行可能です。
[1] サービスの一覧を表示します。
# 現在起動しているサービスの一覧を表示

# [--all] 付加で 停止中も含めて全サービスをリスト

# [--no-pager] 付加で [less/more] 等の pager に渡さない

root@localhost:~#
systemctl -t service

  UNIT
  accounts-daemon.service
  apparmor.service
  apport.service
  blk-availability.service
  cloud-config.service
  cloud-final.service
  
.....
.....

  unattended-upgrades.service
  user-runtime-dir@1000.service
  user@1000.service

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.
55 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

# サービスの起動設定の一覧を表示

root@localhost:~#
systemctl list-unit-files -t service

UNIT FILE                              STATE           VENDOR PRESET
accounts-daemon.service                enabled         enabled
apparmor.service                       enabled         enabled
apport-autoreport.service              static          -
apport-forward@.service                static          -
apport.service                         generated       -
apt-daily-upgrade.service              static          -
apt-daily.service                      static          -
autovt@.service                        alias           -
blk-availability.service               enabled         enabled

.....
.....

vmtoolsd.service                       alias           -
x11-common.service                     masked          enabled
xfs_scrub@.service                     static          -
xfs_scrub_all.service                  static          -
xfs_scrub_fail@.service                static          -

196 unit files listed.
[2] もし自身の環境で不要なサービスがあれば、以下のようにして停止と自動起動の無効化設定をします。
以下の例では Apparmor 停止/無効に設定しています。なお、サービス名末尾の [.service] は省略可能です。
root@localhost:~#
systemctl stop apparmor

root@localhost:~#
systemctl disable apparmor

関連コンテンツ