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
URL call from SHELL script chengwei Shell Programming and Scripting 37 04-15-2009 09:52 PM
Call shell script from php not run ? raccsdl Shell Programming and Scripting 2 11-19-2007 08:21 AM
To call/execute a shell script from a shell script konark UNIX for Dummies Questions & Answers 1 10-26-2007 05:16 PM
How to call a perl script from a shell script anumkoshy Shell Programming and Scripting 2 08-30-2007 04:23 AM
exit a shell script!! sami98 Shell Programming and Scripting 4 03-27-2007 04:55 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-18-2006
heprox heprox is offline
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?
  #2 (permalink)  
Old 11-20-2006
dhananjayk dhananjayk is offline
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)
  #3 (permalink)  
Old 11-20-2006
aju_kup aju_kup is offline
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
Sponsored Links
Closed Thread

Bookmarks

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:50 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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