Debian start-stop-daemon. Java start jar File
Asked Answered
P

1

6

I have this command in a shellscript in /etc/init.d/

start-stop-daemon --start --quiet --make-pidfile --pidfile /var/run/$NAME.pid --background --exec /usr/bin/java -jar /home/username/myjar.jar 

If i execute this i get this error

start-stop-daemon: unable to stat /usr/bin/java -jar /home/username/myjar.jar (No such file or directory)

If i execute

/usr/bin/java -jar /home/username/myjar.jar 

in the commandline everything is fine .. i don't get my mistake :(

Pyknic answered 1/12, 2014 at 23:8 Comment(6)
--chuid root <-- why?Appellant
a result of my desperation .. is removed nowHumpage
please repost your answer.. i noticed to late that you removed the " ' " .. your answer fixed my problem. i will accept itHumpage
Uh, undeleted, but what "'" are you talking about? And does it actually solve the problem?Appellant
OK again my mistake. In the time till your answer i changed something. I made " ' " around the exec statement. But nevertheless your answer fixed my problemHumpage
Good to know :) However, don't forget to --chuid to a "sane" userAppellant
A
13

Try this:

start-stop-daemon --start --quiet --make-pidfile --pidfile /var/run/$NAME.pid \
    --background \
    --exec /usr/bin/java -- -jar /home/username/myjar.jar

It seems like you need to separate the executable (here /usr/bin/java from its argument with --.

(oh, also change the uid to an appropriate user; root should not be required)

Appellant answered 1/12, 2014 at 23:14 Comment(1)
Thank your for the fast and nice responses.Humpage

© 2022 - 2024 — McMap. All rights reserved.