Running commands in backgroud | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Running commands in backgroud

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-26-2013
morbid_angel morbid_angel is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 17 June 2013, 2:34 PM EDT
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Running commands in backgroud

I have a small question may be this will be discussed before

I have two files file1 and file2 with huge data and I am running the commands as

cat file1 |sort &
cat file2 |sort &

If the session is got disconnected or logout will this command run in background,
or shall we use nohup
Sponsored Links
    #2  
Old 03-26-2013
Don Cragun's Avatar
Don Cragun Don Cragun is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 1 November 2014, 4:52 AM EDT
Location: San Jose, CA, USA
Posts: 4,940
Thanks: 186
Thanked 1,657 Times in 1,406 Posts
Get rid of the cats and use nohup:

Code:
nohup sort -o sorted1 file1&
nohup sort -o sorted2 file2&

Sponsored Links
    #3  
Old 03-26-2013
morbid_angel morbid_angel is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 17 June 2013, 2:34 PM EDT
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
I just need to know this command will run in background if the session got disconnected.
    #4  
Old 03-26-2013
hanson44 hanson44 is offline
Registered User
 
Join Date: Mar 2013
Last Activity: 12 May 2013, 11:33 PM EDT
Posts: 858
Thanks: 18
Thanked 180 Times in 177 Posts
Yes, if you use nohup, it will continue to run in background if session is disconnected. That's the whole point of nohup.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Echo out running commands ronron5477 UNIX for Dummies Questions & Answers 2 03-12-2013 09:47 AM
multiple child scripts running in backgroud, how to use grep on the parent? albertashish Shell Programming and Scripting 5 08-02-2008 02:50 AM
piping and backgroud processes (daemons) demwz Shell Programming and Scripting 2 06-20-2008 03:03 AM
running commands from outside of bash rakabarp Shell Programming and Scripting 3 03-13-2008 06:40 AM
backgroud process trynew UNIX for Advanced & Expert Users 4 07-23-2002 05:53 PM



All times are GMT -4. The time now is 09:15 AM.