centos7设置服务为开机自启动(以crond.serivce为例)

本文转自:https://blog.51cto.com/mrxiong2017/2084790

一、设置crond.serivice服务为开机自启动

步骤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

二、开启和关闭crond.service服务

步骤1:查看crond.service的启动状态

systemctl status crond.service

 

开启crond.service服务命令

systemctl start crond.service

 

停止crond.service服务命令

systemctl stop crond.service

 

posted @ 2019-04-18 10:15  习惯沉淀  阅读(1931)  评论(0编辑  收藏  举报