1

I want to start jstatd on my Debian server as a daemon process (which is what I thought it should do on its own ...) but I can't seem to get it to work.

If I run it from the command line, it starts fine, but blocks the terminal session. I can then use VisualVM to monitor the processes remotely (yeah!). But as soon as I hit ^c to get control of the session, jstatd terminates.

Okay, then lets do it via an init.d script!

Again, it works fine, but my terminal session is still blocked.

my start command is

/usr/bin/jstatd -J-Djava.security.policy=/usr/lib/jvm/jre1.7.0_10/bin/jstatd.all.policy

and, as said, works fine as I can see the processes once I execute the command.

In the init.d script, it looks like:

#!/bin/sh
set -e
NAME=jstatd
PIDFILE=/var/run/$NAME.pid
DAEMON=/usr/bin/jstatd
DAEMON_OPTS="-J-Djava.security.policy=/usr/lib/jvm/jre1.7.0_10/bin/jstatd.all.policy

case "$1" in
   start)
     start-stop-daemon --start --quiet --pidfile $PIDFILE -- exec $DAEMON -- $DAEMON_OPTS
...

Any ideas what might be causing such behaviour?

2 Answers2

1

Run jstatd as background process via &. As ordinary user invoke from terminal the following command (note & at the end): /usr/bin/jstatd -J-Djava.security.policy=/usr/lib/jvm/jre1.7.0_10/bin/jstatd.all.policy &

Tomas Hurka
  • 6,723
  • 29
  • 38
0

Maybe you have already solved this, but it seems like there is a space in

-- exec 

before the "exec" itself. Maybe it's a copy-paste issue, but that script should not work, AFAIK

Wakaru44
  • 423
  • 4
  • 14