User manual
Sensorsoft Alert User Manual
Appendix G – Setting up a Routine Email
Notification within the Linux shell
The following Linux shell script allows your Alert appliance to email a periodic sensor reading to reassure
you that the appliance is working as expected. If the alertd or scomd processes are not running this shell
script will also email a critical alert informing you that appropriate action is required. To install this shell
script requires the user to have experience with Linux shell commands and the vi editor.
This shell script uses the sensor’s first variable during the notification. If you are using a ST61XX
thermometer on the sensor port you will receive a temperature sensor reading in Celsius. If you are using a
SS6610 temperature/humidity meter on the sensor port you will receive a humidity sensor reading in %RH.
If you are using a Boolean sensor such as SS6201/SP6400/SS6402 you will receive a state string reading
(i.e. DRY, PWR_OK or OPEN).
1. Login to the Sensorsoft Alert appliance using an ssh tool like putty (port 22). The default login
and password is "root" and "sensorsoft" respectively.
2. Using vi create a shell script file /home/routine_notify.sh and add the following content to it. Edit
the sendmail command line to use the correct email addresses and mailserver address for your
network. If you are using a SS6610 sensor on the sensor port, change the unit of measure C (for
Celsius) to %RH (for humidity). If you are using a boolean sensor on the sensor port, remove the
unit of measure, C from the shell script:
# start of routine notification shell script
agc=0
sgc=0
# count number of alertd processes
agc=`ps | grep alertd | grep –vc grep`
# count number of scomd processes
sgc=`ps | grep scomd | grep –vc grep`
# check that all the alertd threads are running, otherwise we have no
# environmental monitoring or alerting
if [ $agc -lt 6 ]
then
/usr/bin/sendmail -t you@yourdomain.com -f admin@yourdomain.com \
-s "Critical Alert - some or all alertd threads are not running" –m \
"Critical Alert - some or all alertd processes are not running. Login \
using ssh and troubleshoot immediately." -h mailserver
# check that the scomd process is running, otherwise we have no
# environmental monitoring or alerting
elif [ $sgc -lt 1 ]
then
/usr/bin/sendmail -t you@yourdomain.com -f admin@yourdomain.com \
-s "Critical Alert - scomd process is not running" -m "Critical \
Alert - scomd process is not running. Login using ssh and \
troubleshoot immediately." -h mailserver
# email the routine notification
else
/usr/bin/scomd -S ttyS1
Reading=`/usr/bin/scom -Q /home/scomsetup2.ini ttyS1`
/usr/bin/sendmail -t you@yourdomain.com -f admin@yourdomain.com \
-s "Routine Notification $Reading C" -m "This is a routine \
notification from Sensorsoft Alert, reading is $Reading C" \
88