I'm trying to execute a shell script from systemd. The script runs fine from command line.
The script (runServer.sh), runs up a Java process and looks like this:
#!/bin/bash
java -jar -Dresources=/home/pruss/dev/ServerDeploy5-4.1/Server/resources/MyServer.jar "0" "Test"
Inside /usr/lib/systemd/system
(or /lib/systemd/system/
on other OSes) I've created a service file (myService.service):
[Unit]
Description=My Servers service
[Service]
ExecStart=/home/pruss/dev/ServerDeploy5-4.1/Server/runServer.sh
User=root
Type=oneshot
[Install]
WantedBy=multi-user.target
The result
Job for myService.service failed. See "systemctl status myService.service" and "journalctl -xn" for details.
I try:
systemctl status myService.service
Loaded: loaded (/usr/lib/systemd/system/myService.service; disabled)
Active: failed (Result: exit-code) since Thu 2015-07-23 12:27:38 BST; 26s ago
Main PID: 28413 (code=exited, status=203/EXEC)