CentOS 7中systemctl的使用

CentOS 7.x开始,CentOS开始使用systemd服务来代替daemon,原来管理系统启动和管理系统服务的相关命令全部由systemctl命令来代替

1、原来的 service 命令与 systemctl 命令对

daemon命令:service [服务] start/stop/restart/status    

systemctl命令 : systemctl start/stop/restart/status   [unit type]

2、原来的chkconfig 命令与 systemctl 命令对比

daemon命令:chkconfig [服务] on/off   设置开机启动/不启动

systemctl命令 : systemctl enable/disable [unit type]

3、systemctl特殊的用法

systemctl is-active [unit type]         查看服务是否运行

systemctl is-enabled [unit type]     查看服务是否设置为开机启动

systemctl poweroff/reboot/suspend/hibernate    关机/重启/进入睡眠模式/进入休眠模式

 

转自:https://blog.csdn.net/u012486840/article/details/53161574