Unix/Linux Go Back    


Shell Programming and Scripting BSD, Linux, and UNIX shell scripting Post awk, bash, csh, ksh, perl, php, python, sed, sh, shell scripts, and other shell scripting languages questions here.

Running commands in backgroud

Shell Programming and Scripting


Closed    
 
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 online now Forum Staff  
Administrator
 
Join Date: Jul 2012
Last Activity: 2 December 2016, 5:09 PM EST
Location: San Jose, CA, USA
Posts: 9,717
Thanks: 459
Thanked 3,316 Times in 2,837 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 182 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

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 10:47 AM
multiple child scripts running in backgroud, how to use grep on the parent? albertashish Shell Programming and Scripting 5 08-02-2008 03:50 AM
piping and backgroud processes (daemons) demwz Shell Programming and Scripting 2 06-20-2008 04:03 AM
running commands from outside of bash rakabarp Shell Programming and Scripting 3 03-13-2008 07:40 AM
backgroud process trynew UNIX for Advanced & Expert Users 4 07-23-2002 06:53 PM



All times are GMT -4. The time now is 06:11 PM.