The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


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

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-06-2003
Registered User
 

Join Date: May 2002
Posts: 23
Stumble this Post!
Question Not another ksh!

Hi there,
I've coded a script to create a menu system on an AIX machine.

When user selects an item of the menu I perform a program using " nohup somepgm &"

The reason I do that is because usually the scripts behind the menu items are very time-consuming and users logout and log back in later to see the result and if I don’t use "nohup" the programs stop after user logout...

Am I right? Any suggestion?

OK, the problem is here... When you exit from the menu program and get back to command line "jobs" command doesn't show the job is running (because when it gets kicked off by the menu system and nohup a new ksh opens and runs the program)

How can I nohup the programs from the menu system in the way that I can see the job is running... I mean is there any way to nohup the program in the same ksh as the menu system.

Thank you in advance...
__________________
Shaz

Last edited by Shaz; 05-06-2003 at 11:29 AM.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-06-2003
Registered User
 

Join Date: May 2002
Posts: 23
Stumble this Post!
Guys...
I've tried { nohup somepgm & } and still it opens another ksh...
__________________
Shaz
Reply With Quote
  #3 (permalink)  
Old 05-07-2003
google's Avatar
Moderator
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
Stumble this Post!
Take a look at the parent process ID of the jobs you have applied nohup to after you logout and come back online. I dont think your process will own the jobs anymore, I think they are passed off to the INIT process. This would explain why you cannot see the jobs running when you type in the jobs command. However, output of your jobs are sent to $HOME/nohup.out (this can be redirected if you so choose - see man nohup).

Capture the process ID when you place the process in the background and then poll that with kill -0 $LAST_BACKGROUND_ID this will tell you if the job is still running. Of course this will complicate your script quite a bit having to manage these temp files by user...Im sure there is a better way to do this.

Last edited by google; 05-07-2003 at 09:00 AM.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 04:56 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0