Help with Script using rsh and scripts within scripts

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help with Script using rsh and scripts within scripts
# 1  
Old 06-18-2009
Question Help with Script using rsh and scripts within scripts


I've written a script that runs on a Database server. It has to shutdown the Application server, do an Oracle Dump and then restart the Application server. Its been a long time since I wrote any shells scripts. Can you tell me if the scripts that I execute within my script will be executed straight after each other? Or will the shell wait till each script has finished executing before moving on to the next script?

Please see below script:

# Script to Export Oracle tables.
# Check that this script only runs on the DBSERVER
sysname=`uname -n`
case ${sysname} in
*) exit ;;

# Log File Directory
> ${runlog}

#Check that the parameter now has been passed to the script
if [ x${1} != "xnow" ]
echo "ERROR : This script should not be run unless you know how it works.\n"
echo "It will kill ALL Apps sessions and stop the Services on Apps Server "
echo "It will then perform an OracleDump.There are no 'Are you sure?'messages!\n"
echo "If you really want to export, run it again with one parameter, 'now' "
exit 1
# Remote command stop APP on APPSERVER
rundat=`/usr/bin/date +%a' '%d%h%Y' '%H':'%M`
echo "${rundat} ${rserv} Shutdown X3" >> ${slog}
rsh ${rserv} /etc/rc.shutdown >> ${runlog} 2>&1

#Run script to execute export.
rundat=`/usr/bin/date +%a' '%d%h%Y' '%H':'%M`
echo "${rundat} ${sysname} Export Oracle" >> ${slog}

# Remote comamnd to Restart APP on APPSERVER
rundat=`/usr/bin/date +%a' '%d%h%Y' '%H':'%M`
echo "${rundat} ${rserv} Start X3" >> ${slog}
rsh ${rserv} /etc/rc.APP >> ${runlog} 2>&1
# End #
# 2  
Old 06-18-2009
They will execute in sequence, waiting for the previous command to complete.

In the case of the rsh ... rc.shutdown invocation, that script might background the shutdown process -- you'll have to check. For instance, on some systems, that script calls telinit 1 which initiates a shutdown. Another implementation might block until the current shell is terminated by the shutdown process.
# 3  
Old 06-18-2009
To keep the forums high quality for all users, please take the time to format your posts correctly.

For instance, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags [code] and [/code] by hand.)

Thank You.

The UNIX and Linux Forums
# 4  
Old 06-18-2009
Thanks for the reply Otheus. I will check the rc.shutdown script. I'll also remember to tag my code in future Smilie

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

2. Shell Programming and Scripting

Calling scripts from with scripts

Hi all, I'm wondering if you could give me some advice. I am new to scripting and am getting rather frustrated that i can get my script to call another script if certain criteria is met, via command line, but I cannot get the same script to work thru the cron jobs. My first script monitors... (8 Replies)
Discussion started by: echoes
8 Replies

3. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

4. Shell Programming and Scripting

Calling scripts from other script.

I need to call 3 different shell scripts from 2 different scripts, one is a perl script and other is Shell script. In Case -1 : The perl script is and the name of three shell scripts which need to be called from the perl script are, and Each shell script... (1 Reply)
Discussion started by: siba.s.nayak
1 Replies

5. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./ I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

6. Shell Programming and Scripting

Running scripts within scripts from cron

Hi all, I have set up a cron job which calls another shell script shell script which in turn calls a Java process. The cron tab looks so. 0,30 7-18 * * 1-5 /u01/home/weblogic/brp/bin/ >> /u01/home/weblogic/logs/checkstatus.log The scripts looks like this. ... (4 Replies)
Discussion started by: sirbrian
4 Replies

7. Shell Programming and Scripting

Calling scripts within script

Hi, I have written a some six scripts to move large files and re-size them. This has been done step by step, taking backup, creating the new files, merging the files, removing the temporary files created. Since these files are around 500 MB, each step takes somewhere between 1 to 5 mins. ... (1 Reply)
Discussion started by: baanprog
1 Replies

8. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies

9. Shell Programming and Scripting

Run scripts within a script..

Hi all... I have several scripts of varying types (shell script, expect script, awk script) that I would like to run within 1 script.. They also take a command line argument (which it is getting successfully). The problem is, the parent script is exiting after the first script it calls is... (2 Replies)
Discussion started by: earnstaf
2 Replies
Login or Register to Ask a Question

Featured Tech Videos