service、chkconfig与新命令systemctl的区别

service命令与systemctl区别

service一般和ckconfig搭配使用

service常用命令就是启动,停止,重启动和查看服务

service对应systemctl
命令(alert进程为例) service systemctl
启动 service start alert systemctl alert start 
停止 service stop alert systemctl alert stop
重启 service restart alert systemctl alert restart
查看 service status alert systemctl alert status
启动开机自启 对应 

 

chkconfig alert on (reset表示重置) systemctl enable alert
查看所有开机项 chkconfig  --list或直接输入chkconfig 

 

systemctl list-unit-files

 

关闭开机项

 

chkconfig alert off systemctl disable alert
确定某进程是否是开机项

 

service、chkconfig与新命令systemctl的区别

 systemctl is-enabled xxx(进程名)

service、chkconfig与新命令systemctl的区别

systemd是Linux系统中最新的初始化系统(init),它主要的设计目的是提高系统的启动速度。监视和控制systemd的主要命令是systemctl。该命令可用于查看系统状态和管理系统及服务

配置文件:
/usr/lib/systemd/system:每个服务最主要的启动脚本设置,类似于之前的/etc/initd.d
/run/system/system:系统执行过程中所产生的服务脚本,比上面的目录优先运行
/etc/system/system:管理员建立的执行脚本,类似于/etc/rc.d/rcN.d/Sxx类的功能,比上面目录优先运行,在三者之中,此目录优先级最高

chkconfig是管理系统服务(service)的命令行工具。

service、chkconfig与新命令systemctl的区别