This is my systemd service on ubuntu 16.04:
[Unit]
Description=Starts Caspar CG
[Service]
Type=forking
WorkingDirectory=/home/broadcastingza/CasparCG/Server
Environment=DISPLAY=:0
ExecStart=/bin/sh ./run.sh --watch
StandardOutput=null
Restart=on-failure
[Install]
WantedBy=multi-user.target graphical.target
EDIT: This is the output of sudo systemctl status -l
sudo systemctl status start-caspar.service -l
● start-caspar.service - Starts Caspar CG
Loaded: loaded (/etc/systemd/system/start-caspar.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Tue 2017-03-21 17:04:28 SAST; 1 day 16h ago
Process: 5198 ExecStart=/bin/bash -c ./run.sh --watch (code=exited, status=0/SUCCESS)
Mar 21 17:04:14 ZAPS001 systemd[1]: Starting Starts Caspar CG...
Mar 21 17:04:28 ZAPS001 systemd[1]: Started Starts Caspar CG.
This service gets enabled and runs fine. No problems with starting it manually either. The only issue I'm having is that as soon as the shell script runs ("run.sh"), the server it starts up then receives an EXIT signal, and exits with EXIT code 0. It's almost as if the server requires the console to be open all the time.
When I run the exact same script from the console it runs perfectly fine.
Is there a way to start the service without exiting the console immediately, or is there a way to start the service independent of the console in the first place?