The eventhandler is a program or script that smsd runs whenever it receives or sent a message or when it was not able to send a message.
Smsd calls the script before it moves the file from the provider queue into the failed or sent queue.
Smsd gives two arguments to the eventhandler. The first one is SENT, RECEIVED, FAILED or REPORT. The second one is the SMS file filename.
During installation an example script will be copied: /usr/local/bin/smsevent
Example:
#!/bin/sh
# This is an example how to use an eventhandler with smsd.
echo smsd reports an event:
echo type: $1
echo file: $2
if [[ $1 == RECEIVED ]]; then
cat $2 | /usr/sbin/sendmail root@localhost;
fi;
This script displays a message for each event and sends all received messages to the root user by eMail.