CentOS7查看自启列表命令
[root@localhost mysql-rpm]# systemctl list-unit-files # 执行结果:"enabled:自启动","disabled:未自启动"
UNIT FILE STATE
proc-sys-fs-binfmt_misc.automount static
dev-hugepages.mount static
dev-mqueue.mount static
proc-sys-fs-binfmt_misc.mount static
sys-fs-fuse-connections.mount static
sys-kernel-config.mount static
sys-kernel-debug.mount static
tmp.mount disabled
brandbot.path disabled
systemd-ask-password-console.path static
systemd-ask-password-plymouth.path static
systemd-ask-password-wall.path static
session-1.scope static
session-2.scope static
arp-ethers.service disabled
auditd.service enabled
autovt@.service enabled
blk-availability.service disabled
brandbot.service static
console-getty.service disabled
console-shell.service disabled
container-getty@.service static
cpupower.service disabled
crond.service enabled
dbus-org.freedesktop.hostname1.service static
dbus-org.freedesktop.import1.service static
dbus-org.freedesktop.locale1.service static
dbus-org.freedesktop.login1.service static
dbus-org.freedesktop.machine1.service static
dbus-org.freedesktop.NetworkManager.service enabled
dbus-org.freedesktop.nm-dispatcher.service enabled
dbus-org.freedesktop.timedate1.service static
dbus.service static
debug-shell.service disabled
只查看服务类型的开机启动
systemctl --type service list-unit-files
重启或者查看某个服务状态
systemctl restart abrtd.service
systemctl status abrtd.service
设置服务开机启动
systemctl enable nginx.service //设置nginx开机启动
systemctl enable php-fpm.service //php-fpm开机启动
搜索指定状态的服务
systemctl list-unit-files | grep enabled //搜索全部已启动的服务,enabled 启用;disabled 禁用。
搜索指定服务的状态
systemctl list-unit-files | grep nginx //搜索 nginx 的开机启动状态