systemctl和service

systemctl和service是linux中两种服务管理方式

1.service命令
/etc/init.d/目录中存放的是一系列系统服务的管理(启动与停止)脚本
/etc/init.d是指向/etc/rc.d/init.d的软连接
service命令则是去/etc/init.d/目录下,去执行相关程序脚本
所以服务程序脚本需在该目录下存在,可用 service 服务名 检查是否存在

chkconfig管理系统服务命令,
所谓系统服务(service),就是随系统启动而启动,随系统关闭而关闭的程序

如启动http服务 service httpd start
如设置开机自启 chkconfig httpd on

2.systemctl命令
systemd是Linux系统最新的初始化系统,对应的进程管理命令是systemctl
systemctl命令脚本存放在/usr/lib/systemd/目录下
也兼容了service, 即也会去/etc/init.d目录下查看执行相关程序
所以systemctl命令会查看两个目录
systemctl实际上将 service 和 chkconfig 这两个命令组合到一起

启动http服务 systemctl start httpd
设置开机自启 systemctl enable httpd

posted on 2020-03-27 20:47  流年似水zlw  阅读(810)  评论(0编辑  收藏  举报

导航