在Centos7以下版本,主要使用chkconfig管理系统服务,Centos7中主要使用systemctl管理,Centos7也保留了chkconfig命令
列出系统服务:
[root@linux ~]# systemctl list-unit-files
该命令会列出所有系统服务,以及服务的状态(enabled、disabled、static:表示该服务与其他服务关联,不能单独设置状态,可能需要等待其他服务唤醒)
只查看service服务:
[root@linux ~]# systemctl list-units --all --type=service
不加- -all 只列出在运行的(active)服务,未运行(inactive)的服务不会显示
启动服务:
[root@linux ~]# systemctl restart crond.service
关闭服务:
[root@linux ~]# systemctl stop crond.service
重启服务:
[root@linux ~]# systemctl restart crond.service
查看服务状态: