Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-13-2013
pandeesh's Avatar
Registered User
 
Join Date: Jul 2011
Posts: 311
Thanks: 75
Thanked 12 Times in 12 Posts
Nohup not returns to the prompt

Hi i have a script and i ma running that via nohup and &.
I am expecting that to return to the user prompt immediately.
But it's not returning and returns only after i press ctrl+c.
i am invoking the script as follow as :

Code:
nohup ./script args &


Code:
$ nohup: appending output to `nohup.out'

How to make that to return it to the user prompt immediately rather than displaying the above message and waiting?

Thanks
Sponsored Links
    #2  
Old 03-13-2013
itkamaraj's Avatar
^Kamaraj^
 
Join Date: Apr 2010
Posts: 3,025
Thanks: 33
Thanked 647 Times in 625 Posts
try this...


Code:
nohup ./script args > /tmp/out.txt &

The Following User Says Thank You to itkamaraj For This Useful Post:
pandeesh (03-13-2013)
Sponsored Links
    #3  
Old 03-13-2013
pandeesh's Avatar
Registered User
 
Join Date: Jul 2011
Posts: 311
Thanks: 75
Thanked 12 Times in 12 Posts
It's working. But what makes the difference and how it works?

Thanks,
    #4  
Old 03-13-2013
Mead Rotor
 
Join Date: Aug 2005
Location: Saskatchewan
Posts: 16,373
Thanks: 490
Thanked 2,535 Times in 2,418 Posts
The only difference is redirecting the message to the text file. Otherwise they act the same.

I think it is actually returning control to your prompt, especially since you put & after it, but it prints (once) over your prompt before it does, causing confusion.
Sponsored Links
    #5  
Old 03-13-2013
alister alister is offline Forum Advisor  
Registered User
 
Join Date: Dec 2009
Posts: 2,601
Thanks: 123
Thanked 717 Times in 600 Posts
Quote:
Originally Posted by itkamaraj View Post
Code:
nohup ./script args > /tmp/out.txt &

Quote:
Originally Posted by pandeesh View Post
It's working. But what makes the difference and how it works?
Thanks,
Quote:
Originally Posted by Corona688 View Post
The only difference is redirecting the message to the text file. Otherwise they act the same.
Actually, the message is not redirected; the message is simply not generated.

That informational message is written by nohup to stderr only when stdout is a terminal, forcing it to choose a new destination for stdout (and possibly stderr, if it to is a terminal).

Regards,
Alister
Sponsored Links
Reply

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
Calculation returns no value Daniel Gate Shell Programming and Scripting 3 07-21-2011 02:14 PM
Grep returns nothing DallasT Shell Programming and Scripting 16 04-29-2010 09:34 AM
Grep without returns... mrwatkin UNIX for Dummies Questions & Answers 1 07-24-2009 01:22 PM
longjmp never returns axes Programming 2 09-10-2006 08:22 PM
script returns prompt kburrows UNIX for Dummies Questions & Answers 3 10-06-2003 10:12 AM



All times are GMT -4. The time now is 07:47 AM.