Hi,
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:
#!/bin/sh
# Script to Export Oracle tables.
# Check that this script only runs on the DBSERVER
sysname=`uname -n`
case ${sysname} in
DBSERVER) rserv="APPSSERVER" ;;
*) exit ;;
esac
line="-------------------------------------------------------------\
-----------------"
# Log File Directory
slog="/x3log/export"
runlog="/x3log/export/explog"
> ${runlog}
#Check that the parameter now has been passed to the script
if [ x${1} != "xnow" ]
then
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
fi
# 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}
/x3log/export/all_exp_DB_scr.sh
# 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 #
#-------------------------------------------------------#