-   Linux - Newbie (
-   -   Difficulty in understanding nohup Command. (

sowraj 01-28-2010 12:29 AM

Difficulty in understanding nohup Command.
Hi, I am new to Linux i have the following script which is used to strat the weblogic admin server.

#Script to start admin server

# Set all environment variables specific to Services Domain
. /export/home/{USERID}/domains/{DOMAIN_NAME}/bin/

TSTAMP=`/usr/bin/date '+%m.%d.%y-%H:%M:%S'`;

if [[ -a ${SERVER_LOG} ]]; then
USER_MEM_ARGS="-Xms200m -Xmx200m -XX:MaxPermSize=128m"; export USER_MEM_ARGS
nohup ./ 1> “$DOMAIN_HOME/servers/{Admin_server_name}/logs/weblogic.out” 2>&1 &

can somebody help me in understanding the above script.

what is being checked in the if condition : if [[ -a ${SERVER_LOG} ]]what is the significance of -a in the above if condition.

what does export USER_MEM_ARGS does?
Also can you please explain the nohup command : what is the significance of &1 & in the nohup command

GrapefruiTgirl 01-28-2010 12:48 AM

Hi, welcome to LQ!

First, a suggestion: Please edit your post to get rid of the orange text; it is VERY hard to read. Use regular black text. Also, if you could put [code] tags around the script, that would be good too :)


1) -a is the same as -e but this may differ depending on which particular shell you are using. -e is used to check if a file exists, so if supported in your shell, -a would do the same thing. So, the test in your script, checks to see if the filename contained in the variable $SERVER_LOG is an existing file.

2) export SOMETHING, means export the value of the SOMETHING variable, into the shell's environment, to make it available to any scripts of programs running in that shell.

3) Things such as &1, &2, &0 refer to 'file descriptors', specifically "standard output" and "standard error" and "standard input". Messages coming from any program running, are returned to the user via standard output, unless they are errors, which arrive via standard error. Standard Input, is how data gets inputted into the program.

4) nohup is used to run a program in such a way that it will ignore the HUP or HANGUP signal.

All of this and much much more, is available on the man page of your shell. So, if using Bash shell, type "man bash" at a prompt, and read through the documentation. nohup has a man page of its own.


chrism01 01-28-2010 01:59 AM

See also

Welcome to LQ

All times are GMT -5. The time now is 02:48 AM.