Unix/Linux Go Back    


Shell Programming and Scripting Unix shell scripting - KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and shell scripts and shell scripting languages here.

Running commands in backgroud

Shell Programming and Scripting


Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 03-26-2013
morbid_angel morbid_angel is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 27 January 2015, 2:20 PM EST
Posts: 33
Thanks: 2
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 Unix and Linux 03-26-2013
Don Cragun's Unix or Linux Image
Don Cragun Don Cragun is offline Forum Staff  
Moderator
 
Join Date: Jul 2012
Last Activity: 2 August 2015, 8:56 PM EDT
Location: San Jose, CA, USA
Posts: 6,835
Thanks: 289
Thanked 2,280 Times in 1,950 Posts
Get rid of the cats and use nohup:

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

Sponsored Links
    #3  
Old Unix and Linux 03-26-2013
morbid_angel morbid_angel is offline
Registered User
 
Join Date: Nov 2009
Last Activity: 27 January 2015, 2:20 PM EST
Posts: 33
Thanks: 2
Thanked 0 Times in 0 Posts
I just need to know this command will run in background if the session got disconnected.
    #4  
Old Unix and Linux 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 181 Times in 178 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 Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux 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 02:37 AM.