Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-28-2010, 01:29 AM   #1
LQ Newbie
Registered: Jan 2010
Posts: 3

Rep: Reputation: 0
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

Last edited by sowraj; 01-28-2010 at 01:31 AM.
Old 01-28-2010, 01:48 AM   #2
LQ Guru
Registered: Dec 2006
Location: underground
Distribution: Slackware64
Posts: 7,594

Rep: Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555Reputation: 555
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.

Old 01-28-2010, 02:59 AM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,329

Rep: Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745Reputation: 2745
See also

Welcome to LQ


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux vs. Windows: Understanding the Difficulty Divide LXer Syndicated Linux News 0 05-27-2008 09:41 PM
nohup command used but process is still killed helptonewbie Linux - Newbie 4 02-13-2007 05:44 PM
problem with nohup command and nohup file size vbseeker Linux - General 1 09-17-2006 12:36 PM
Difficulty in understanding Gins Programming 6 07-12-2006 05:22 PM
nohup command chbin Slackware 1 03-31-2005 04:47 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration