如何在 Red Hat Linux 中重启后自动启动服务?

我们可以运行以下命令在重新启动后自动启动服务

# chkconfig service_name on

但是上面的命令只会为当前运行级别启用服务,所以我更喜欢使用下面的命令

# chkconfig --level 35 service_name on

使用 level 参数,我们可以选择希望服务运行的运行级别

重启后查看所有当前启用的服务

下面的命令将显示为运行级别 3 和 5 启用的所有服务

# chkconfig --list | awk '{print "tt",  , }' | grep on
acpid            3:on 5:on
anacron          3:on 5:on
atd              3:on 5:on
auditd           3:on 5:on
cimlistenerd     3:on 5:on
cimserverd       3:on 5:on
cpuspeed         3:on 5:on
crond            3:on 5:on
dcerpcd          3:on 5:on
eventlogd        3:on 5:on
haldaemon        3:on 5:on
日期:2020-06-02 22:16:54 来源:oir作者:oir