你的位置:首页 > 操作系统

[操作系统]CentOS7 systemctl的使用


# 查看正在运行的服务

systemctl

 

# 查看某个服务的状态

systemctl status httpd.service

 

# 启动服务

systemctl start  foo.service

如:systemctl start httpd.service 

 

# 停止服务

systemctl stop foo.service

如:systemctl stop httpd.service

 

# 重启服务

systemctl restart foo.service

如:systemctl restart httpd.service

 

# 重新加载配置文件

systemctl reload  foo.service

如:systemctl reload httpd.service

 

# 开机时启动一个服务

systemctl enable foo.service

如:systemctl enable httpd.service

 

# 开机时关闭一个服务

systemctl disable foo.service

如:systemctl disable httpd.service

 

# 查看服务是否开机启动

systemctl is-enabled foo.service

如:systemctl is-enabled httpd.service