I have a java application that I manage to execute by hand. The application normally opens several ports for local communications (7180 => 7183). Port 7182 serves as a web console and allows me to quickly check that everything went fine.

java -cp $ARCHIVES -Djava.security.policy=$POLICY -Dconfigfile=$CONFIG_FILE $CLASS

As soon as I put this in an init script, the ports are not open but the app somehow manages to start with the following message: 'Dead or echo port not responding'.

Here is the start-stop-daemon line in my init script:

start-stop-daemon --start --chuid thomas --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON -- \

What difference between manual execution and scripted execution could explain that the app is half started?

As an additionnal information, the application is SIPS Office Server (payment solution).

  • Are you running it as a designated user in both cases or as yourself when it works, and root during init?
    – slm
    Jun 28, 2013 at 15:32
  • I guess init script runs the daemon as root unless you specify it with --chuid username, which I tried. It works when I run the java command line directly from my user thomas, but not when I --chuid thomas from init script.
    – cellover
    Jul 1, 2013 at 7:07
  • Can you share the entire init script? Also what's the distro?
    – slm
    Jul 2, 2013 at 6:56
  • Here you can find an anonymized version of the script: pastebin.com/4z5vvMC5 - please note that I am working on this script in the lab environment.
    – cellover
    Jul 2, 2013 at 16:08

1 Answer 1


Based on what you've posted your approach looks OK. I found an example init script that uses the following line:

start-stop-daemon --oknodo --start --quiet --chuid $USER --pidfile $PIDFILE \
    --exec $DAEMON -- --pid-file $PIDFILE

This is directly out of the file: /etc/init.d/speech-dispatcher.

I'd pay special attention to the pidfile and might even direct it manually to a path that you're absolutely positive that user thomas has read/write access to just to make sure that your problem isn't a permissions problem.

  • I indeed checked that the pidfile was correctly created, which is the case. I should have said that when I test the init script, I launch it with such a command line: nohup ./my_script start >> myscript.log
    – cellover
    Jul 2, 2013 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .