systemctl is-enabled 检查服务是否开启自启动

systemctl 命令之后有很多选项和命令。罗列几个常用的命令。

#service --status-all

#列出全部服务
systemctl list-units --type=service

#查看一个服务的状态,列出有没有正在执行、开机时是否启动等信息。
systemctl status 服务名.service

#开启服务自启动,下次开机服务启动
systemctl enable 服务名.service

#禁用服务自启动,下次开机时,服务不会被启动
systemctl disable 服务名.service

#检查一个服务是否正在运行
systemctl is-active 服务名.service

#检查一个服务的设置,是否为自启动的
systemctl is-enabled 服务名.service


systemctl [command] [unit]

systemctl start  #立刻启动后面接的 unit。
systemctl stop  #立刻关闭后面接的 unit。
systemctl restart  #重启动服务,先关闭再启动的意思。
systemctl reload  #不关闭 unit 的情况下,重新载入配置文件,让设置生效。
systemctl kill  #杀死一个服务的所有子进程。
systemctl show  #列出 unit 的配置。
systemctl mask  #注销 unit,注销后你就无法启动这个 unit 了。
systemctl unmask  #取消对 unit 的注销。

systemctl daemon-reload #重新加载服务配置文件

作者: Mr.Tang

伯虎

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注

  −  1  =  1