can I make a function in zoneminder that sends an email at <x> o clock, when there has NOT been any motion events on monitor <n> for the last <y> hours?
if not,
how can i make a cron-job, running at <x> o clock that sends an email to <email> at <smtp> , when there has NOT been any motion events on monitor <n> for the last <y> hours?
p.s. I am a newbee in linux
new (?) function
Try this (untested):
Save it to a file, make the file executable (chmod a+x filename) and run it in a cron job.
You will have to set the initial variables to your particular setup.
INTERVAL is in seconds.
Code: Select all
#!/usr/bin/ksh
MYSQL=/usr/bin/mysql
USER=zm_admin
PASS=password
ID=1
DB=zm
INTERVAL=3600
EMAIL="somebody@example.com a.n.other@example.com"
since=`$MYSQL -ss -u $USER --password=$PASS -D $DB -e "select UNIX_TIMESTAMP() - UNIX_TIMESTAMP(max(StartTime)) from Events where MonitorId = $ID"`
if [ $since -gt $INTERVAL ]
then
mailx -s "No alarms for $since seconds" $EMAIL <<EOF
Zoneminder has not alarmed for $since seconds.
.
EOF
fi
exit 0
You will have to set the initial variables to your particular setup.
INTERVAL is in seconds.
-
- Posts: 4
- Joined: Wed May 26, 2010 12:48 pm
debug
hi
this looks ok. but it doesn't work
because i am a newbee in scripting. How can i put debug statement in this script, and where can i find the output ?
this looks ok. but it doesn't work
because i am a newbee in scripting. How can i put debug statement in this script, and where can i find the output ?