CentOS7 – systemd服务



CentOS7 - systemd服务

systemd是服务管理程序,他整合了service和chkconfig的功能为一体,可以永久性或只在当前会话中启用/禁用服务。

#查看正在运行的服务
systemctl

#启动,停止,重启服务
systemctl start foo.service
systemctl stop foo.service
systemctl restart foo.service

#查看一个服务的状态
systemctl status foo.service

#开机时启用一个服务
systemctl enable foo.service

#开机时关闭一个服务
systemctl disable foo.service

#查看服务是否开机启动
systemctl is-enabled foo.service
例:开机启动sshd服务

systemctl enable sshd.service