5
1
I've written a systemd service to start groundcontrol on my Raspberry Pi.
[Unit]
Description=Groundcontrol status monitor
[Service]
ExecStart=/opt/groundcontrol/groundcontrol/start.sh
Type=forking
[Install]
WantedBy=multi-user.target
I'm using the script because groundcontrol will not work properly unless started from the bin directory. Here is the script:
cd /opt/groundcontrol/groundcontrol
./groundcontrol &
This works perfectly when I start it manually, but when I start up my Pi and run systemctl
it says it has failed. systemctl status groundcontrol.service
prints
groundcontrol.service - Groundcontrol status monitor
Loaded: loaded (/etc/systemd/system/groundcontrol.service; enabled)
Active: failed (Result: exit-code) since Wed 1969-12-31 17:00:14 MST; 43 years 11 months ago
Process: 111 ExecStart=/opt/groundcontrol/groundcontrol/start.sh (code=exited, status=0/SUCCESS)
Main PID: 116 (code=exited, status=2)
Dec 31 17:00:11 waldo systemd[1]: Starting Groundcontrol status monitor...
Dec 31 17:00:12 waldo systemd[1]: Started Groundcontrol status monitor.
Dec 31 17:00:14 waldo systemd[1]: groundcontrol.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 31 17:00:14 waldo systemd[1]: Unit groundcontrol.service entered failed state.
When I run it manually the status is
groundcontrol.service - Groundcontrol status monitor
Loaded: loaded (/etc/systemd/system/groundcontrol.service; enabled)
Active: active (running) since Thu 2013-12-26 15:38:02 MST; 1s ago
Process: 296 ExecStart=/opt/groundcontrol/groundcontrol/start.sh (code=exited, status=0/SUCCESS)
Main PID: 297 (groundcontrol)
CGroup: /system.slice/groundcontrol.service
`-297 ./groundcontrol
Dec 26 15:38:02 waldo systemd[1]: Started Groundcontrol status monitor.
There was a System V init script provided with groundcontrol but I didn't know how to use it with systemd - is this possible, and will it work better than my service? If not, how can I fix this service? Thanks.
You need to understand
groundcontrol
and its requirements so that you can order it correctly in the boot process. – Pavel Šimerda – 2015-04-05T06:11:04.983