beautypg.com

HP B6960-90078 User Manual

Page 750

background image

Further Information

Examples of Pre-Exec and Post-Exec Commands for UNIX

Appendix A

A-20

Examples of Pre-Exec and Post-Exec
Commands for UNIX

The following scripts are some examples of Pre- and Post- exec
commands on UNIX.

Session Pre-Exec:
Shut Down
Application

The script shuts down an Oracle instance.

#!/bin/sh

export ORACLE_HOME=$2

export ORACLE_SQLNET_NAME=$1

if [ -f $ORACLE_HOME/bin/svrmgrl ]; then

$ORACLE_HOME/bin/svrmgrl << EOF

connect sys/manager@$ORACLE_SQLNET_NAME as sysdba

shutdown

EOF

echo "Oracle database \"$ORACLE_SID\" shut down."

exit 0

else

echo "Cannot find Oracle SVRMGRL

($ORACLE_HOME/bin/svrmgrl)."

exit 1

fi

Disk Image
Pre-Exec:
Unmount a Disk
Before a Raw
Volume Backup

#!/bin/sh

echo "The disk will be unmounted!"

umount /disk_with_many_files

if [ $? = 0 ]

then

echo "The disk has been successfully unmounted!"

exit 0