Linux中通过systemctl服务管理

格式:
systemctl[选项][服务名称]
选项:
start 启动服务
stop 关闭服务
restart 重启服务
status 查看当前服务器状态
reload 重新加载配置文件
condrestart 测试新的配置文件是否有问题
enable 设置服务默认为开机启动服务
disable 设置服务默认为开机禁用服务
示例:

# systemctl start sshd          启动sshd服务
# systemctl stop sshd           关闭sshd服务
# systemctl restart sshd        重启sshd服务
# systemctl status sshd         查看当前服务器状态
# systemctl reload sshd         重新加载配配置文件
# systemctl condrestart  sshd   测试新的配置文件是否有问题
# systemctl enable sshd         设置服务器默认为开机启动服务
# systemctl disable shhd        设置服务器默认为开机禁用服务

猜你喜欢

转载自blog.csdn.net/gao_2109/article/details/90546069