内容一:systemd 服务管理文件在系统中的位置
/etc/systemd/system/
内容二:systemd 服务管理文件的常用参数
[Unit]
Description=<service name>
Before=<another1.service> <another2.service> <another3.service>......
After=<another1.service> <another2.service> <another3.service>......
Requires=<another1.service> <another2.service> <another3.service>......
[Service]
Type=<type name>
ExecStart=<script>
[Install]
WantedBy=<action1>.target
WantedBy=<action2>.target
WantedBy=<action3>.target
......
(
补充:
1) Description= 服务的名称
2) Before= 必须在什么服务启动之前启动此服务
3) After= 必须在什么服务启动之后启动此服务
4) Requires= 启动此服务必须要求什么服务
5) Type= 启动此服务的方式,可以是 oneshot 或者 forking
6) ExecStart= 要执行的脚本
7) WantedBy= 在系统执行什么动作时启动此服务,可以是 default.target、poweroff.target、reboot.target 或者 halt.target
)
