本文发表在 rolia.net 枫下论坛#!/bin/ksh
# NAME: cleanup()
#
# DESCRIPTION: unsets traps, issues error messages and exits with a return code
#
# INPUT:
# $1 = exit code
# $2 = message if not null
#
cleanup ()
{
ec=$1
msg=$2
if [ $ec != 0 ]
then
printf "Batch Job Failure.....\n" >>$LOG_FILE
else
printf "Job completed; return code $ec DATE:`now`\n" >>$LOG_FILE
fi
trap -
exit "$ec"
}
################### main ##################
{
#####
/usr/sbin/mknod /tmp/exp_pipe p
compress </tmp/exp_pipe>/u06/export/fullexp_wacarc.dmp.Z &
ORA_EXP_FILE="/tmp/exp_pipe"
########
export LOG_DIR ORA_EXP_FILE
LOG_FILE=$LOG_DIR/fullexp_wacarc.log
JOB_SERVER=`hostname`
JOB_NAME=`basename $0 .sh`
DATETIME=`date '+%Y%m%d'`
mv /u06/export/day_2/fullexp_wacarc.dmp.Z /u06/export/day_3
mv /u06/export/day_1/fullexp_wacarc.dmp.Z /u06/export/day_2
mv /u06/export/fullexp_wacarc.dmp.Z /u06/export/day_1
#
# Trap on exit/interrupt/break to clean up
#
trap "cleanup 99 \">>> Abnormal program termination..."\" 1 2 15
#
# Initialize the logfile...
#
printf "Server: $JOB_SERVER\n" >$LOG_FILE
printf "Job: $JOB_NAME started DATE:`now`\n" >>$LOG_FILE
$ORACLE_HOME/bin/exp userid=system/${sidpwd} file=$ORA_EXP_FILE \
log=$LOG_DIR/full_backup.log full=y
RC=$?
[ $RC != 0 ] &&cleanup $RC "Export wacarc"
cleanup 0
}更多精彩文章及讨论,请光临枫下论坛 rolia.net
# NAME: cleanup()
#
# DESCRIPTION: unsets traps, issues error messages and exits with a return code
#
# INPUT:
# $1 = exit code
# $2 = message if not null
#
cleanup ()
{
ec=$1
msg=$2
if [ $ec != 0 ]
then
printf "Batch Job Failure.....\n" >>$LOG_FILE
else
printf "Job completed; return code $ec DATE:`now`\n" >>$LOG_FILE
fi
trap -
exit "$ec"
}
################### main ##################
{
#####
/usr/sbin/mknod /tmp/exp_pipe p
compress </tmp/exp_pipe>/u06/export/fullexp_wacarc.dmp.Z &
ORA_EXP_FILE="/tmp/exp_pipe"
########
export LOG_DIR ORA_EXP_FILE
LOG_FILE=$LOG_DIR/fullexp_wacarc.log
JOB_SERVER=`hostname`
JOB_NAME=`basename $0 .sh`
DATETIME=`date '+%Y%m%d'`
mv /u06/export/day_2/fullexp_wacarc.dmp.Z /u06/export/day_3
mv /u06/export/day_1/fullexp_wacarc.dmp.Z /u06/export/day_2
mv /u06/export/fullexp_wacarc.dmp.Z /u06/export/day_1
#
# Trap on exit/interrupt/break to clean up
#
trap "cleanup 99 \">>> Abnormal program termination..."\" 1 2 15
#
# Initialize the logfile...
#
printf "Server: $JOB_SERVER\n" >$LOG_FILE
printf "Job: $JOB_NAME started DATE:`now`\n" >>$LOG_FILE
$ORACLE_HOME/bin/exp userid=system/${sidpwd} file=$ORA_EXP_FILE \
log=$LOG_DIR/full_backup.log full=y
RC=$?
[ $RC != 0 ] &&cleanup $RC "Export wacarc"
cleanup 0
}更多精彩文章及讨论,请光临枫下论坛 rolia.net