4

For reference, I'm using phpseclib to control a remote SSH server using the 'root' account.

I have to start/stop a java process which is ran in the background. Stopping works fine with killall java and this is all I need for now, although when I run the server, I'm using:

(cd ./serv/; nohup java -classpath bin:deps/poi.jar:deps/netty.jar:deps/mysql.jar:deps/slf4j.jar:deps/slf4j-nop.jar:deps/jython.jar:log4j-1.2.15.jar: server.Server &)

As you can see, I am using the & operator for the second command inside the brackets. The command would execute correctly though the page would keep loading waiting for a return value/exit code? And it would eventually use up all the memory on my webhost.

The answer was that you need to manually direct the output of nohup:

Edit: Answer!!

(cd ./serv/; java -classpath bin:deps/poi.jar:deps/netty.jar:deps/mysql.jar:deps/slf4j.jar:deps/slf4j-nop.jar:deps/jython.jar:log4j-1.2.15.jar: server.Server >/tmp/test.out 2>&1 &)

Thanks to Mikeserv for the help.

12
  • 7
    Toby - will you please move the answer part of the question to an answer? You should feel free to accept your own answer, by the way.
    – mikeserv
    Jul 30, 2014 at 11:36
  • 2
    I can't for 7 hours. But yes, I will. Jul 30, 2014 at 11:37
  • 3
    @TobyWisener, welcome to the site, please add the answer to answers and accept it you don't put the answer in the question, I recommend you to read this page: unix.stackexchange.com/tour
    – Nidal
    Jul 30, 2014 at 14:06
  • 1
    Time passes: it is time to move than answer to the answer section, and tick √ it. Aug 13, 2014 at 13:00
  • 1
    @mikeserv Can you provide your comment as an answer to this post?
    – Sebastian
    Sep 19, 2014 at 13:50

1 Answer 1

1
cd ./serv/; java -classpath bin:deps/poi.jar:deps/netty.jar:deps/mysql.jar:deps/slf4j.jar:deps/slf4j-nop.jar‌​:deps/jython.jar:log4j-1.2.15.jar: server.Server >/tmp/test.out 2>&1 &

Answer courtesy of @mikeserv, I'm posting it at the request of @Sebastian so that this gets removed from the unanswered queue (a year and a half later).

You must log in to answer this question.

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