#!/bin/bash # cameramon.sh V1.0 # Chris Jones 12/21/2013 # Script used to convert email alerts from ipcamera into mochad. # *In ipcameras settings set "sender" or "from" value to the value you will assign device in securitypi's web interface. ############ Settings ################## # port to receive email alert CAMPORT=5000 # port for Mochad (Default 1099) MOCHADPORT=1099 #SMTP Response File SMTPFILE="/.security/scripts/smtpresponse" ######################################## # monitor port for email requests while true do CAMERA=$( nc -l -p $CAMPORT < $SMTPFILE | awk 'NR==2{print $1}' RS="<" FS=">" ) DATE=$( date +"%m/%d %H:%M:%S" ) echo "$DATE Rx CAMSEC Addr: $CAMERA Func: Motion_alert_IPCAMERA" | nc localhost $MOCHADPORT done