4347l6 Listing 6. #!/bin/sh # # This shell script if placed in /etc/apcupsd # will be called by /etc/apcupsd/apccontrol when the UPS # goes on batteries. We send an email message to root # to notify him. # SYSADMIN=root MAIL="bin/mail" HOSTNAME=`hostname` # echo "HOSTNAME Power Failure" >/tmp/$$ echo " " >>/tmp/$$ /sbin/apcaccess status 2>>/tmp/$$ cat /tmp/$$ | $MAIL -s "HOSTNAME Power Failure !!!" $SYSADMIN exit 0