16
5
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)
And, if you're getting class not found exceptions - might take a look at my answer on SO https://stackoverflow.com/questions/21503883/spring-boot-application-as-a-service/49482664#49482664 took a few hours of my life to figure out the stupid issue ;-(
– JGlass – 2018-03-26T01:16:15.120