1.
使用 systemctl list-unit-files 可以查看啟動項
systemctl list-unit-files | grep enable 過濾查看啟動項如下
abrt-ccpp.service enabled abrt為auto bug report的縮寫 用於bug報告 關閉
abrt-oops.service enabled ----------------------
abrt-vmcore.service enabled ----------------------
abrt-xorg.service enabled ----------------------
abrtd.service enabled ----------------------
auditd.service enabled 安全審計 保留
autovt@.service enabled 登陸相關 保留
crond.service enabled 定時任務 保留
dbus-org.freedesktop.NetworkManager.service enabled 桌面網卡管理 關閉
dbus-org.freedesktop.nm-dispatcher.service enabled ----------------------
getty@.service enabled tty控制台相關 保留
irqbalance.service enabled 優化系統中斷分配 保留
kdump.service enabled 內核崩潰信息捕獲 自定
microcode.service enabled 處理器穩定性增強 保留
NetworkManager-dispatcher.service enabled 網卡守護進程 關閉
NetworkManager.service enabled ----------------------
postfix.service enabled 郵件服務 關閉
rsyslog.service enabled 日志服務 保留
snmpd.service enabled snmp監控 數據抓取 保留
sshd.service enabled ssh登陸 保留
systemd-readahead-collect.service enabled 內核調用--預讀取 保留
systemd-readahead-drop.service enabled ----------------------
systemd-readahead-replay.service enabled ----------------------
tuned.service enabled
default.target enabled 默認啟動項 multi-user.target的軟連接 保留
multi-user.target enabled 啟動用戶命令環境 保留
remote-fs.target enabled 集合遠程文件掛載點 自定
runlevel2.target enabled 運行級別 用於兼容6的SysV 保留
runlevel3.target enabled ----------------------
runlevel4.target enabled ----------------------
關閉一下開機啟動服務
systemctl disable abrt-ccpp.service
systemctl disable abrt-oops.service
systemctl disable abrt-vmcore.service
systemctl disable abrt-xorg.service
systemctl disable abrtd.service
systemctl disable accounts-daemon.service
systemctl disable atd.service
systemctl disable auditd.service
systemctl disable autovt@.service
systemctl disable avahi-daemon.service
systemctl disable bluetooth.service
systemctl disable cups.service
systemctl disable dbus-org.bluez.service
systemctl disable dbus-org.fedoraproject.FirewallD1.service
systemctl disable dbus-org.freedesktop.Avahi.service
systemctl disable dbus-org.freedesktop.ModemManager1.service
systemctl disable dbus-org.freedesktop.NetworkManager.service
systemctl disable dbus-org.freedesktop.nm-dispatcher.service
systemctl disable display-manager.service
systemctl disable dmraid-activation.service
systemctl disable firewalld.service
systemctl disable gdm.service
systemctl disable irqbalance.service
systemctl disable iscsi.service
systemctl disable ksm.service
systemctl disable ksmtuned.service
systemctl disable libstoragemgmt.service
systemctl disable libvirtd.service
systemctl disable lvm2-monitor.service
systemctl disable mcelog.service
systemctl disable mdmonitor.service
systemctl disable microcode.service
systemctl disable ModemManager.service
systemctl disable multipathd.service
systemctl disable NetworkManager-dispatcher.service
systemctl disable NetworkManager.service
systemctl disable postfix.service
systemctl disable qemu-guest-agent.service
systemctl disable rngd.service
systemctl disable rtkit-daemon.service
systemctl disable smartd.service
systemctl disable spice-vdagentd.service
systemctl disable systemd-readahead-collect.service
systemctl disable systemd-readahead-drop.service
systemctl disable systemd-readahead-replay.service
systemctl disable tuned.service
systemctl disable vgauthd.service
systemctl disable vmtoolsd.service
2.systemctl 用法:
顯示服務狀態:systemctl status docker.service
列出服務層級和依賴關系:systemctl list-dependencies docker.service
啟動服務:systemctl start docker.service
關閉服務:systemctl stop docker.service
重啟服務:systemctl restart docker.service
設置服務自啟動:systemctl enable docker.service
禁止服務自啟動:systemctl disable docker.service
查看服務是否自啟動:systemctl is-enabled docker.service
列出系統所有服務的啟動情況:systemctl list-units --type=service
列出所有自啟動服務:systemctl list-unit-files|grep enabled
對應的舊指令(chkconfig、service)
顯示服務狀態:service docker status
列出服務層級和依賴關系:systemctl list-dependencies docker.service
啟動服務:service docker start 關閉服務:service docker stop 重啟服務:service docker restart 設置服務自啟動:chkconfig --level 3 docker on 禁止服務自啟動:chkconfig --level 3 docker off 查看服務是否自啟動:chkconfig --list docker 列出系統所有服務的啟動情況:chkconfig --list
