linux的service服务管理命令和systemctl服务管理的区别

SysV服务chkconfig命令service命令和systemd服务管理systemctl命令

1.说明

在CentOS6.X中SysV服务用命令chkconfig/service来管理服务,而在CentOS7.X将由systemd的systemctl命令来管理服务。以下是SysV与systemd服务控制表

2.服务控制表

SysV服务systemd服务作用
service NAME stopsystemctl stop NAME停止服务
service NAME statussystemctl status NAME看服务运行状态
service NAME startsystemctl start NAME启动服务
service NAME restartsystemctl restart NAME重启服务
service NAME reloadsystemctl reload NAME重新加载配置(不终止服务)
chkconfig NAME onsystemctl enable NAME开机自动启动
chkconfig NAME offsystemctl disable NAME开机不自动启动
chkconfig --list NAMEsystemctl is-enabled NAME查看指定服务是否为开机自启动
chkconfig --listsystemctl list-unit-files查看服务的启动和禁用状态
chkconfig --add NAMEsystemctl daemon-reload创建新服务文件或变量设置
 systemctl is-active NAME查看服务是否在运行中
 systemctl mask NAME禁止服务运行
 systemctl unmask NAME取消禁止服务运行

3.服务状态说明

服务状态状态说明
loaded服务单元配置文件已被处理
active(running)服务的一个或多个进程在运行中
active(exited)一次性运行的服务成功被执行并退出(服务运行任务后,相关进程会自动退出)
active(waiting)服务已经运行但在等待某个事件
inactive服务没有在运行
enabled服务设置为开机启动
disabled服务设置为开机不启动
static服务不能被设置开机启动,但可以由其它服务启动该服务

4.更多参考

Wiki:点击到达

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值