Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debian start-stop-daemon. Java start jar File

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 :(

like image 722
Yannic Klem Avatar asked Dec 01 '14 23:12

Yannic Klem


1 Answers

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)

like image 113
fge Avatar answered Sep 30 '22 13:09

fge