What does this command means - "nohup ./standalone.sh -b 0.0.0.0 &"?

I have a heavy application running on jboss-7.1.1 on linux server. I came across this command to start the jboss "nohup ./standalone.sh -b 0.0.0.0 &". But i want to understand more about this command line. Also the nohup.out file size keeps on increasing day by day. Is it due to the command line that i executed to start the jboss. Is there any way to avoid nohup.out to get created.

1

2 Answers

nohup

nohup makes the following command immune to the SIGHUP signal. It detaches the command from the terminal. When a terminal is closed, any process (or commands) running in the terminal are sent the SIGHUP (hang-up) signal and then die.

This means that if the terminal screen is closed (the terminal from where ./standalone.sh is started), standalone.sh remains running. It is detached from it's terminal.

Foreground and background

The & at the end of the command puts the standalone.sh program in the background. Background means that the command does not block the terminal shell. A command in the foreground on the other hand will block any input to the terminal shell until it has completed.

An example: read -p "enter name " expects input from the user. It blocks the terminal shell until ENTER is keyed. The read command is in the foreground and blocks the terminal from receiving further commands. A background process does not block the shell that started it.

nohup.out

This file contains the output from the command issued using nohup. In your case it is the output from the standalone.sh script.

You can direct the output from a command to a file:

nohup ./standalone.sh -b 0 0 0 0 & > myfile.txt 

Or even dispose of the output by writing to /dev/null. If you do this you will lose any errors generated by the command.

 nohup ./standalone.sh -b 0 0 0 0 & > /dev/null 

If you want to preserve any error messages, but want to ignore any other output, then redirect the error stream (stream 2) thus:

 nohup ./standalone.sh -b 0.0.0.0 & >/dev/null 2>my-error-file.txt" 
2

Just want to add to great suspectus's answer:

./standalone.sh -b 0.0.0.0 

./standalone.sh start jboss-7.1.1 in standalone mode (war files located in JBOSS_HOME/standalone/deployments using JBOSS_HOME/standalone/configuration configs and so on) on all available networks.

-b sets system property jboss.bind.address and 0.0.0.0 means on all network interfaces. Like 127.0.0.1, your external IP address, your IP in your local network and so on. So, your jboss will be available on all network interfaces you are currently connected.

0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like