service、systemd、systemctl 笔记1

                     

贡献者: addis

  • 本文处于草稿阶段。

   You can start and stop it manually with systemctl start scanner.service and systemctl stop scanner.service and see its status with systemctl status scanner.service.

   See Arch Linux help about systemd

更多参数

代码 2:名字.service
[Unit]
Description=服务的描述
Documentation=文档的url
After=在哪些服务运行后运行(如果它们没运行也没关系)
Before=在哪些服务之前运行(如果它们没运行也没关系)
Wants=在运行之前试图运行的另一个服务(如果失败也没关系)
Requires=在运行之前试图运行的另一个服务(如果失败就不运行)

[Service]
ExecStart=/路径/命令 参数1 参数2
ExecStop=/路径/命令 参数1 参数2
ExecStartPre=/路径/命令 参数1 参数2
Restart=always, on-failure, on-abnormal, on-watchdog, on-abort, no.
Type=simple(默认)|forking|oneshot|dbus, notify and idle.
User=运行服务的用户
Group=运行服务的组
Environment=环境变量
EnvironmentFile=环境变量文件

[Install]
WantedBy=在这个 target 启动该 service,失败也没关系
RequiredBy=失败有关系

1. supervisor

                     

© 小时科技 保留一切权利