The script below could be added to a script file in order to set up environment variables prior to placing the script into a scheduled crontab cron job.
#!/bin/ksh ORACLE_BASE=/<mount-point-1>/oracle ORACLE_HOME=$ORACLE_BASE/product/8.1.7 LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/openwin/lib JAVA_HOME=$ORACLE_BASE/jre/1.1.8 TNS_ADMIN=/<mount-point-1>/oracle/product/8.1.7/network/admin ORACLE_SID=TEST ORACLE_DBF=/<mount-point-1>/oracle/oradata/$ORACLE_SID ORACLE_BACKUPS=/<mount-point-2>/backups ORACLE_SBIN=$ORACLE_HOME/sbin ORACLE_ALERT=$ORACLE_BASE/admin/$ORACLE_SID/bdump PATH=/bin:/usr/bin:/etc:/usr/ccs/bin:/usr/openwin/bin:/usr/ucb:/usr/local/bin:/usr/sbin:/usr/X/bin:$JAVA_HOME PATH=${PATH}:$ORACLE_HOME/bin:$ORACLE_HOME/sbin host=`hostname` if [ -z "$ORACLE_BASE" ] || [ -z "$ORACLE_HOME" ] || [ -z "$LD_LIBRARY_PATH" ] || [ -z "$JAVA_HOME" ]\ || [ -z "$TNS_ADMIN" ] || [ -z "$ORACLE_SID" ] || [ -z "$ORACLE_DBF" ] || [ -z "$ORACLE_BACKUPS" ]\ || [ -z "$ORACLE_SBIN" ] || [ -z "$ORACLE_ALERT" ] || [ -z "$PATH" ] || [ -z "$host" ]; then echo "$0 aborted - variable not defined" mailx -s "$0 aborted - variable not defined" $email < /dev/null exit 1 fi USAGE="$0: Incorrect arguments, Usage: $0 <\"email1 email2 ... emailn\">" if [ `whoami` != 'oracle' ]; then echo "$0 aborted - user `whoami` is incorrect, must be user oracle" mailx -s "$0 aborted - user `whoami` is incorrect, must be user oracle" $email < /dev/null exit 1 elif [ -z "$1" ]; then echo "$USAGE" mailx -s "$USAGE" gpowell@startups.com < /dev/null exit 1 fi email=$1 echo "Executing $0 on $host"
The crontab entries below could be used to execute a script where the recipients is file containing a list of email address, ie. “name1@address.com name2@address.com … namen@anotheraddress.com”.
0 6 * * * cat /<mount-point-1>/oracle/product/8.1.7/sbin/recipients | xargs /bin/ksh /<mount-point-1>/oracle/product/8.1.7/sbin/ora600.ksh 1 6 * * * cat /<mount-point-1>/oracle/product/8.1.7/sbin/recipients | xargs /bin/ksh /<mount-point-1>/oracle/product/8.1.7/sbin/diskspace.ksh