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.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
URL call from SHELL script chengwei Shell Programming and Scripting 33 08-26-2008 06:21 AM
Call shell script from php not run ? raccsdl Shell Programming and Scripting 2 11-19-2007 04:21 AM
To call/execute a shell script from a shell script konark UNIX for Dummies Questions & Answers 1 10-26-2007 02:16 PM
How to call a perl script from a shell script anumkoshy Shell Programming and Scripting 2 08-30-2007 01:23 AM
exit a shell script!! sami98 Shell Programming and Scripting 4 03-27-2007 01:55 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-18-2006
Registered User
 

Join Date: Jul 2005
Posts: 32
Question Have a shell script call another shell script and exit

I have a shell script that calls another shell script "str_process_main" that runs in a loop until a given time. I want the first script to just call the second one and then exit. The first script is:

Code:
#!/bin/ksh
DATE=$(date +%m%d%y)
DPID=$(ps -ef|grep str_process_main|grep -v grep)
if [ "${DPID}" = "" ]; then
   cd /usr/local/wss_polling
   str_process_main
   echo "The process was not running."
else
   echo "The process is already running: $DPID."
fi
exit
The first script just sits there and runs?
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 11-20-2006
Registered User
 

Join Date: Aug 2006
Posts: 12
check it

just call the second script as

#!/bin/ksh
DATE=$(date +%m%d%y)
DPID=$(ps -ef|grep str_process_main|grep -v grep)
if [ "${DPID}" = "" ]; then
cd /usr/local/wss_polling
. str_process_main
echo "The process was not running."
else
echo "The process is already running: $DPID."
fi
exit

note that the 2nd script is called using a dot (.)
this dot notation runs the second script in the same shell ..i.e calling shell ..
if u call it without using a dot ...then also the script will run ... but in a new shell ..( sub-shell)
Reply With Quote
  #3 (permalink)  
Old 11-20-2006
Registered User
 

Join Date: Jul 2006
Posts: 189
run the script with nohup in background

#!/bin/ksh
DATE=$(date +%m%d%y)
DPID=$(ps -ef|grep str_process_main|grep -v grep)
if [ "${DPID}" = "" ]; then
cd /usr/local/wss_polling
nohup str_process_main &
echo "The process was not running."
else
echo "The process is already running: $DPID."
fi
exit
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:05 PM.


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

Content Relevant URLs by vBSEO 3.2.0