Centos7 查看自启动列表systemctl list-unit-files以及设置服务自启动

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 的开机启动状态

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值