管理系统服务 systemctl

命令: systemctl COMMAND  name.service

-

centOS6

CentOS7

启动

service name start

systemctl start name.service

停止

service name stop

systemctl stop name.service

重启

service name restart

systemctl restart name.service

状态

service name status

systemctl status name.service

重载或重启服务(先加载,再启动)

-

systemctl reload-or-restart   name.service

chkconfig命令的对应关系

-

centOS6

CentOS7

设定某服务开机自启

chkconfig name on

systemctl enable name.service

设定某服务开机禁止启动

chkconfig name off

systemctl disable name.service

查看所有服务的开机自启状态

chkconfig --list

systemctl list-unit-files --type   service

用来列出该服务在

哪些运行级别下启用和禁用

chkconfig sshd –list

ls   /etc/systemd/system/*.wants/sshd.service

查看服务是否开机自启

-

systemctl is-enabled name.service

服务状态

# systemctl list-unit-files      #显示状态

•       loaded:Unit配置文件已处理

•       active(running):一次或多次持续处理的运行

•       active(exited):成功完成一次性的配置

•       active(waiting):运行中,等待一个事件

•       inactive:不运行

•       enabled:开机启动

•       disabled:开机不启动

•       static:开机不启动,但可被另一个启用的服务激活

版权声明:
作者:WaterBear
链接:https://l-t.top/1517.html
来源:雷霆运维
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>