-   Linux - Newbie (
-   -   question about nohup in shell (

raulab 02-22-2011 07:28 PM

question about nohup in shell
Hi I have a command in a shell script along with a bunch of command.

Th command prints out stuff on stdout and stays printing since the server is up.

However eve though I want to start the server I want it to continue executing the commands after ./ in the same flow.

How can I achieve it?

marco18 02-22-2011 07:46 PM

What does does exactly?

chrism01 02-22-2011 09:12 PM

I think what you want is '&' ie to background the task, which enables the rest of the script to continue. However if it's outputting to stdout, you should capture that.
nohup is used to allow a cmd issued from the cmd line to continue after you logout. Putting it all together looks like this

nohup >myprog.log 2>&1 &
NB: these 3 i/o channels are automatically assigned to every process
sdtin = 0
stdout = 1
stderr = 2

raulab 02-23-2011 01:37 PM

thanks that anaswered my question. One quesiton about this. what is the symbol > here?

chrism01 02-23-2011 08:47 PM

> = redirect output to specified channel
>> = append output to specified channel

If you use the first, it will always overwrite any same named file at each new invocation. OTOH, if you don't want append (ie one file for all invocations), embed the current date in the target output filename.
Note also that you can send stdout & stderr to different files, but matching the contents up afterwards is a PITA. I rarely split them...

All times are GMT -5. The time now is 03:14 AM.