Execute script immediately after alarm state is triggered
Posted: Wed Apr 27, 2011 9:34 am
I'm looking for a convenient way to execute a script immediately after a monitor has gone into alarm state.
Currently I have a very simple filter (if cause is Motion and Duration greater than 0) to upload matches, send email and run custom script. When a motion alarm is triggered the following will happen in order:
One solution I found on this forum is to actively tail syslog for "Gone into alarm state" and trigger the script that way. Although this solution would work, it seems a bit too ugly hack for me.
Does anyone have any suggestions how I could run a custom script as soon as a monitor goes into alarm state? Is there a zm?_* script where I could add an exec (or similar) line (I couldn't find this myself)?
Currently I have a very simple filter (if cause is Motion and Duration greater than 0) to upload matches, send email and run custom script. When a motion alarm is triggered the following will happen in order:
- Monitor goes into alarm state
- When there's no more motion the monitor leaves alarm state
- Notification email gets sent
- Files will be uploaded to FTP server
- Script gets executed
One solution I found on this forum is to actively tail syslog for "Gone into alarm state" and trigger the script that way. Although this solution would work, it seems a bit too ugly hack for me.
Does anyone have any suggestions how I could run a custom script as soon as a monitor goes into alarm state? Is there a zm?_* script where I could add an exec (or similar) line (I couldn't find this myself)?