Running a command in background?

Steve Holmes steve at holmesgrown.com
Tue Jun 18 07:58:57 EDT 2002


I've seen the nohup mentioned various times and yet I do things like
<command> & with no 'nohup' and I could logout without killing the job
so wonder what the nohup is really doing there.  

Further thing, Teddy, if you want to be able  to followup and see the
output of this job later on, you can do something like this; just
substitute command with the command-line and options of your choosing.
command >outfile 2>&1 &
the >outfile redirects all output to the file, outfile and the 2>&1
forces both stdout and stderr to be captured; the & forces the command
into background as has been previously mentioned.

If you don't redirect the output this way, you will loos access to any
output the command has to offer when you logout.

I've compiled my kernel this way numerous times; start this up, logout
go away and log back in several hours later with output waiting for
me.

I should also add that when output is being captured this way, you can
also monitor this output later, if the job is still running, by 'tail
-f outfile' The tail command lets you look at the file while it is
still being written to.  Just hit the control-C key to break out of
tail when you want to get out.

See 'man tail' for more info.

On Tue, Jun 18, 2002 at 07:10:51PM +1000, Shaun Oliver wrote:
> Hi teddy,
> Try using nohup command &
> the nohup allows you to run a process without interuption. even when you
> logout.
> the & or ampusand, tells the second command to background itself after
> execution.
> so if you do that and then logout, it'll continue to run.
> hth
> 
> 
> -- 
> Shaun Oliver
> 
> 
> In a world whithout fences
>           and walls who needs Windows and Gates?
> 
> EMAIL: shaun_oliver at optusnet.com.au
> ICQ: 76958435
> 
> 
> 
> _______________________________________________
> Speakup mailing list
> Speakup at braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup




More information about the Speakup mailing list