当然,为了兼容性,我们原来习惯使用的service命令在CentOS7中仍然是可以使用的,它会重定向命令到新的systemctl工具命令,这个我们应该有看到的。但是在这篇文章中,既然用到新的CentOS7,那我们就来看看新的systemctl工具操作命令组,算是一个学习记录,以后应该有需要用到。
第一、启动、终止、重启
> systemctl start httpd.service #启动
> systemctl stop httpd.service #停止
> systemctl restart httpd.service #重启
第二、设置开机启动/关闭
> systemctl enable httpd.service #开机启动
> systemctl disable httpd.service #开机不启动
第三、检查httpd状态
> systemctl status httpd.service
