centos 7 中的unit管理单元

通过添加/usr/lib/systemd/system/{Server_Name}.service 文件或/etc/systemd/system/中对应init模式文件(/etc目录的文件是库文件的软链接)使服务实现systemctl管理

.service文件组成

1、[Unit] 服务说明

此部分是服务的描述信息,描述服务的启动依赖等

2、[Service] 服务运行参数设置

Type=forking后台运行的形式
PIDFile 存放PID的文件路径
ExecStart 服务的运行命令路径(绝对路径)
ExecReload 服务的重启命令路径(绝对路径)
ExecStop 服务的停止命令路径(绝对路径)

3、[Install] 服务的安装相关配置

原文地址:https://www.cnblogs.com/zh-dream/p/14857459.html