Systemd 服务在脚本中省略了命令

Systemd service leaves out command in script

我正在尝试通过 systemd 启动名为 pigpiod.service 的服务。它使用三个命令调用脚本。第二个被遗漏了。这是为什么?

/etc/systemd/system/pigpiod.服务:

[Unit]
Description=Starts pigpiod
Before=touchscreen.service

[Service]
ExecStart=/home/sysop/pigpiod.sh

[Install]
WantedBy=multi-user.target

/home/sysop/pigpiod.sh:

#!/bin/sh

touch /home/sysop/before_pigpiod
/usr/bin/pigpiod
touch /home/sysop/after_pigpiod

这是 sudo systemctl status pigpiod -l 启动后的输出:

● pigpiod.service - Starts pigpiod
   Loaded: loaded (/etc/systemd/system/pigpiod.service; enabled)
   Active: inactive (dead) since Sat 2017-09-16 20:02:03 UTC; 2min 29s ago
  Process: 440 ExecStart=/home/sysop/pigpiod.sh (code=exited, status=0/SUCCESS)
 Main PID: 440 (code=exited, status=0/SUCCESS)

Sep 16 20:02:02 kivypie systemd[1]: Starting Starts pigpiod...
Sep 16 20:02:02 kivypie systemd[1]: Started Starts pigpiod.

为什么 systemd 会跳过 /usr/bin/pigpiod 的执行,但手动 运行 root 脚本却不会?

我的系统:Raspberry Pi型号3B,RaspbianGNU/Linux8(杰西)

pigpiod 没有 -g 选项。所以使用 Type = forking 或使用 pigpiod -g

[Unit]
Description=Starts pigpiod
Before=touchscreen.service

[Service]
ExecStart=/home/sysop/pigpiod.sh
Type=forking

[Install]
WantedBy=multi-user.target