计算机网络/计算机科学与应用/系统/运维/开发

Linux 系统服务systemd

Linux 系统服务systemd

CentOS7.x 与 CentOS6.x 区别在于 系统启动,服务管理组件的变化

从init变化为systemd, service xxx start 变成 systemctl start xxx


init 命令 有2个缺点:

1、串行执行,不能并发,启动时间长

2、脚本复杂


systemd : 可以并行执行,减少启动时间,使用简单,功能强大


CentOS6.x 管理服务:

# service network start 

# /etc/init.d/network  status


CentOS7.x 管理服务:

# systemctl status network


注意:CentOS 7.x是兼容init的,init脚本还可以继续使用


systemctl 是 systemd 的主命令,用于管理系统
systemctl reboot 重启
systemctl poweroff 关闭电源
systemctl halt cpu停止工作
systemctl suspend  暂停系统,数据保存到内存
systemctl hibernate 休眠状态 数据保存到硬盘
systemctl rescue  进入单用户模式(救援模式)



systemd 与 Unit:


systemd 添加自定义服务:

(1)在目录/etc/systemd/system下新建服务文件frpc.service

vi /etc/systemd/system/frpc.service

(2)文件内容如下


所有的努力,不是为了让别人觉得你了不起,而是为了能让自己打心眼里看得起自己。

评论

^