# apcupsd selftest mail notification



## DadAN (Jun 16, 2011)

Hello,
I try to setup apcupsd let me to send notification when selftest start, 
I have APC SMART-UPS700 connected via serial port using CABLE: Custom Cable Smart, 
and I create this script to send me notification called "startselftest"


```
#!/bin/sh
#
# This shell script if placed in /etc/apcupsd
# will be called by /etc/apcupsd/apccontrol when the UPS
# start selftest.
# We send an email message to root to notify him.
#
SYSADMIN=root
APCUPSD_MAIL="/usr/bin/mail"

HOSTNAME=`hostname`
MSG="$HOSTNAME Start selftest"
#
(
 echo "$MSG on APC UPS attached to $HOSTNAME"
 echo " "
 /usr/local/sbin/apcaccess status
 ) | $APCUPSD_MAIL -s "$MSG" $SYSADMIN
exit 0
```

and permission of this script is


```
-rwxr--r--  1 root  wheel    422 Jun 15 11:47 startselftest
```

When I try to run this script manually it works 
	
	



```
./apccontroll startselftest
```
I recieve mail correctly but when is selftest done (every 168hours/1week)
I dind't recieve notification about it and I can see in log apcupsd.events that selftest was done, what I do wrong?


----------

