1)服務狀態
1.檢查服務器服務狀態
[root@lee ~]# systemctl -t 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
abrt-xorg.service loaded active running ABRT Xorg log watcher
abrtd.service loaded active running ABRT Automated Bug Reporting Tool
atd.service loaded active running Job spooling tools
auditd.service loaded active running Security Auditing Service
avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
chronyd.service loaded active running NTP client/server
colord.service loaded active running Manage, Install and Generate Color Prof
crond.service loaded active running Command Scheduler
cups.service loaded active running CUPS Printing Service
.......
2)顯示服務開機啓動列表
[root@lee ~]# systemctl list-unit-files -t service
UNIT FILE STATE
abrt-ccpp.service enabled
abrt-oops.service enabled
abrt-pstoreoops.service disabled
abrt-vmcore.service enabled
abrt-xorg.service enabled
abrtd.service enabled
accounts-daemon.service enabled
anaconda-direct.service static
anaconda-nm-config.service static
anaconda-noshell.service static
.......
3)停止服務取消開機自啓動
[root@lee ~]# systemctl [狀態] [服務]
[root@lee ~]# systemctl [選項] [服務]
[root@lee ~]# systemctl stop postfix.service
[root@lee ~]# systemctl disable postfix
4)開機啓動
[root@lee ~]# systemctl enable postfix
5)查看 SysV 服務啓動狀態
[root@lee ~]# chkconfig --list
注意:該輸出結果只顯示 SysV 服務,並不包含原生 systemd 服務。SysV 配置數據可能被原生 systemd 配置覆蓋。
如果您想列出 systemd 服務,請執行 'systemctl list-unit-files'。
欲查看對特定 target 啓用的服務請執行
'systemctl list-dependencies [target]'。
netconsole 0:關 1:關 2:關 3:關 4:關 5:關 6:關
network 0:關 1:關 2:開 3:開 4:開 5:開 6:關
rhnsd 0:關 1:關 2:開 3:開 4:開 5:開 6:關