: !/bin/sh # Telmax21 DR replication rmach="telmax21" export rmach ## Testing #override_emaillist="support@transmit.com.au" host=`uname -n` YYYYMMDDhhmm=`date +%Y%m%d%H%M` DORSYNCEMAILLISTFILE="$CATDB/dorsync.emaillist" tmpfile="/tmp/dorsyncall_${host}_${YYYYMMDDhhmm}.tmp" rm -f "$tmpfile" #------------------------------------- email_file() { #echo "email_file() attfiles=[$attfiles] extratxtfiles=[$extratxtfiles] subject=[$subject] emaillist=[$emaillist] rm -f /tmp/hc.eml if [ "$override_emaillist" != "" ]; then echo "override_emaillist=[$override_emaillist]" emaillist="$override_emaillist" fi for emailaddr in $emaillist do #realemail=$emailaddr ##echo "realemail=[$realemail]" if [ "$override_email" != "" ]; then echo "override_email=[$override_email]" emailaddr="$override_email" fi echo "Sending to emailaddr=[$emailaddr]" # Force mail to pass DATE as GMT TZ=''; export TZ ( if [ -n "$emailheader" ]; then echo "$emailheader " echo " " fi for extraf in $extratxtfiles do if [ -n "$extraf" ]; then cat $extraf echo " " fi done for attf in $attfiles do uuencode $attf `basename $attf` done ) | mail -s "$subject" $emailaddr done } #----------------------------------------------------------------------------- # main ( echo "dorsyncall: DORSYNCEMAILLISTFILE=$DORSYNCEMAILLISTFILE" cat "$DORSYNCEMAILLISTFILE" echo "" dorsync 2>&1 "/u/spare" dorsync 2>&1 "/u/catcom" dorsync 2>&1 "/u/catcom/reports" dorsync 2>&1 "/u/catcom/database" dorsync 2>&1 "/u/catcom/wb" dorsync 2>&1 "/tmp" ) >"$tmpfile" 2>&1 #----------------------------------------------------------------------------- # send log to configured addesses subject="$host Telmax21 DR dorsync" if [ -f "$DORSYNCEMAILLISTFILE" ]; then emaillist=`cat "$DORSYNCEMAILLISTFILE"` fi emailheader="Log of output from dorsyncall..." echo "" >>"$tmpfile" 2>&1 extratxtfiles="$tmpfile" email_file >>"$tmpfile" 2>&1 #----------------------------------------------------------------------------- # send log to stdout #cat "$tmpfile" #----------------------------------------------------------------------------- # cleanup rm -f "$tmpfile" exit 0