欢迎来到之路教程(on itroad-com)

启用或者禁用服务的自动启动

在启动时启用自动启动服务(相当于 chkconfig):

# systemctl enable [service_name]

例如:

# systemctl enable multipathd

在启动时禁用自动启动服务:

# systemctl disable [service_name]

例如:

# systemctl disable multipathd

列出服务

列出活动的服务单元:

# systemctl list-units --type service

列出所有已安装服务单元的启用/禁用状态:

# systemctl list-unit-files --type service

服务的启动、停止和检查状态

启动一个服务:

# systemctl start [service_name]

例如:

# systemctl start multipathd

停止服务:

# systemctl stop [service_name]

例如:

# systemctl stop multipathd

检查服务的状态:

# systemctl status [service_name]

例如:

# systemctl status multipathd
在CentOS/RHEL 7中使用systemctl 替换旧的service/ chkconfig命令

本文列出了 RHEL 7 中新的 systemctl 命令以及旧的 service/chkconfig 命令。
旧d 命令 service 和 chkconfig 在 RHEL 7 中仍然与流行命令 systemctl 的转发/重定向信息输出兼容。

日期:2020-09-17 00:12:07 来源:oir作者:oir