Start-stop-daemon and java program

I have a hell of a time when a Java program runs correctly in an init script using start-stop-daemon. I wrote an init script and it seems to run, but will never represent the running program after that.

Here is a snippet of my init script

#! /bin/sh # # DAEMON="/usr/bin/java" DAEMON_ARGS="-server -cp <bunch of RMI arguments and classpath stuff> -jar <absolute path>/myprog.jar" PIDFILE="/var/run/myprog.pid" case "$1" in start) echo -n "Starting myprog" start-stop-daemon --start --pidfile "$PIDFILE" --chuid "myuser" --verbose --background --make-pidfile --startas "$DAEMON" -- $DAEMON_ARGS echo "." ;; 

When I try to run it through /etc/init.d, I get the following:

/etc/init.d#/etc/init.d/myscript start

Running myprogStarting / usr / bin / java ...

Disabling to run / usr / bin / java ... done.

.

After that, the java interpretation process running myprog.jar is not started

I tried various combinations --exec, --start with more or less the same results. If I could get more visibility into what's going on, I'm sure I can understand it, but I'm not sure how to do it.

Any suggestions?

(I am running Angstrom on the embedded ARM platform, so the Java Service Wrapper is actually not a viable option, i.e. I don't think it is available for ARM)

I'm stuck, so any advice would be really appreciated.

Thanks.

+8
java arm start-stop-daemon angstrom-linux
source share
2 answers

Two things to try, first try removing --startas and using --exec instead like this:

 start-stop-daemon --start --pidfile "$PIDFILE" --chuid "myuser" --verbose --background --make-pidfile --exec "$DAEMON" -- $DAEMON_ARGS 

Secondly, since you are using --background , try specifying the --chdir option if the working directory is not / .

I eventually stumbled upon your question, trying to solve my problem, which was ultimately resolved with --chdir , I believe that it will also solve your problem.

+14
source share

Are you looking for a way to launch and be able to control it?

Have you tried programming ms batch dos?

eg

 @echo off cd DirectoryOfFiles echo "Starting up..." java -Xmx512m mainFile pause 

mainFile = main.java? DirectoryOfFiles = directory in which there are all class files, if the running file is the same directory, just delete this line

hope this is what you are asking

-4
source share

All Articles