The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Execute "find . -exec grep" in desending Order gav_dhiman UNIX for Dummies Questions & Answers 6 02-06-2009 05:29 PM
Execute "telinit q" while programs are running ? vilius AIX 1 11-28-2008 05:38 AM
Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" Lokesha UNIX for Dummies Questions & Answers 4 12-20-2007 01:52 AM
"nohup" and "&" commands xadamz23 UNIX for Dummies Questions & Answers 1 08-12-2003 04:31 PM
Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour sameerdes UNIX for Advanced & Expert Users 1 08-28-2002 08:41 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-23-2009
aster007 aster007 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 11
using mutiple "nohup" to execute multiple commands.

I need to run multiple commands on remote server using the nohup...
I have tried 2 options

1) rsh <SERVER_NAME> -n "nohup perl $SCRIPTS_DIR/abc.pl ; $SCRIPTS_DIR/xyz.ksh & " &

2) rsh <SERVER_NAME> -n "nohup perl $SCRIPTS_DIR/abc.pl & nohup $SCRIPTS_DIR/xyz.ksh & " &

I need to know if the 1st command places both the scripts in "nohup", or do I have to use the second command to have both the scripts running without hangup?

Which is more optimised and effective, if both are solving my purpose?
  #2 (permalink)  
Old 02-24-2009
otheus's Avatar
otheus otheus is offline Forum Staff  
Moderator ala Mode
  
 

Join Date: Feb 2007
Location: Innsbruck, Austria
Posts: 1,884
The second is better. However, in both cases, output may get corrupted, since two nohups running at once will both try to output to nohup.out. I think a better idea would be to do split them into two separate rsh's.
Code:
rsh SERVER_NAME -n '( $SCRIPTS_DIR/abc.pl &> $HOME/abc.out) &'
rsh SERVER_NAME -n '( $SCRIPTS_DIR/xyz.ksh &> $HOME/xyz.out ) &'
By putting the execution of the shell into a sub-shell (...) you avoid the need for nohup. Once it is backgrounded and output redirected, the process won't see signals like SIGHUP when the parent shell executes.

Because the shell exits almost immediately, rsh should return very soon thereafter, and thus it is not needed to put rsh in the background.
  #3 (permalink)  
Old 03-06-2009
aster007 aster007 is offline
Registered User
  
 

Join Date: Jul 2008
Posts: 11
I did use your syntax...but not entirely...
as the "()" stuff was somehow not working...
did use multiple rsh...with nohups on each one

Thanks a lot for the suggestions provided.
The multiple "rsh's" did help!
Closed Thread

Bookmarks

Tags
code, multiple nohup, nohup

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0