【发布时间】:2019-04-15 18:24:01
【问题描述】:
我目前正在尝试在我使用引导的 Raspberry Pi 3 时启动程序。该程序控制无人机,在启动之前需要网络连接。当我尝试使用 Systemd 启动此程序时,我收到此错误消息;
droneStartup.service - The Drone Startup service.
Loaded: loaded (/etc/systemd/system/droneStartup.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2019-04-15 14:06:24 EDT; 1s ago
Process: 1895 ExecStart=/bin/bash /home/pi/Systemd_test.py (code=exited, status=2)
Main PID: 1895 (code=exited, status=2)
Apr 15 14:06:24 pi systemd[1]: Started The Drone Startup service..
Apr 15 14:06:24 pi bash[1895]: from: can't read /var/mail/time
Apr 15 14:06:24 pi bash[1895]: /home/pi/Systemd_test.py: line 4: syntax error near unexpected token `'Looping...''
Apr 15 14:06:24 pi bash[1895]: /home/pi/Systemd_test.py: line 4: ` print('Looping...')'
Apr 15 14:06:24 pi systemd[1]: droneStartup.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 15 14:06:24 pi systemd[1]: droneStartup.service: Unit entered failed state.
Apr 15 14:06:24 pi systemd[1]: droneStartup.service: Failed with result 'exit-code'.
这是我用来测试启动的占位符程序;
from time import sleep
while True :
print('Looping...')
sleep(1)
这是我正在使用的 .service 文件;
[Unit]
Description=The Drone Startup service.
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/bin/bash /home/pi/Systemd_test.py
[Install]
WantedBy=multi-user.target
我不知道为什么会出现语法错误,非常感谢任何有关此问题的帮助。
【问题讨论】:
标签: linux raspberry-pi raspbian systemd