Debian start-stop-daemon. Java file start file

I have this command in 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 do 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 do

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

everything is ok on the command line .. I'm not mistaken :(

+5
source share
1 answer

Try the following:

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

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

(oh, also change uid to the corresponding user, root not required)

+12
source

Source: https://habr.com/ru/post/1208092/


All Articles