centos7设置服务开机自启动

以httpd为例

步骤1:查看crond.serivce服务的自启动状态
[root@localhost ~]# systemctl is-enabled crond.service
disabled

此时crond.serivce的自启动状态为disabled

步骤2:开启crond.serivce服务自启动

[root@localhost ~]# systemctl enable crond.service

[root@localhost ~]# systemctl is-enabled crond.service
enabled

列出所有的启动文件:

systemctl list-unit-files

列出所有状态为enable的启动文件

systemctl list-unit-files | grep enable

关闭crond.serivce的自启动状态

systemctl disable crond.service

猜你喜欢

转载自blog.csdn.net/wyk9916/article/details/81428407