Further Information
Examples of Pre-Exec and Post-Exec Commands for UNIX
Appendix AA-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