1.37.5 run process on new event

Current Development version likely to have breaking changes
Post Reply
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

1.37.5 run process on new event

Post by iconnor »

It has been asked for many times, well I finally implemented it.

You can now specify a program to run both when an event starts, and when it ends.

This means you don't have to constantly monitor shm for new events.

Find it on the first table of monitor editing called Event Start Command and Event End Command. Put the full path to the program. The first argument will be the event Id. You will have to query the db for any other info you need.
Alec
Posts: 52
Joined: Thu Aug 17, 2017 3:55 am

Re: 1.37.5 run process on new event

Post by Alec »

Is there a possibility that this feature could be enhanced to run on alarm instead of just on a new event? It seems running on a new event is really only useful for monitors in Modect; I think on alarm would give greater flexibility.

Thanks,

Alec
DFU
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: 1.37.5 run process on new event

Post by iconnor »

If someone creates a PR for it I will consider merging it.
Otherwise someone will have to pay to have it done.
I'd rather work on adding MQTT support.
mrd
Posts: 269
Joined: Wed Apr 26, 2006 12:39 am
Location: Boston USA

Re: 1.37.5 run process on new event

Post by mrd »

I'm having a little trouble with this. I'm sure I'm missing something simple, but I can't get the script to execute. I saw one ERR in syslog when I first created the script and it was owned by root. I changed ownership to the local user as an attempt to resolve the problem, but that hasn't helped and I don't see any evidence that zm is trying to execute it. I have tried forcing an alarm, even though I've had many recorded events while debugging this and nothing has worked.

Is there a specific location for the script? I have it in the /home/zmadmin user directory on my host.
Is there a specific owner/group that works? Permissions are 777 so that should not be an issue..

Any advice would be great.
MRD
User avatar
iconnor
Posts: 3197
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: 1.37.5 run process on new event

Post by iconnor »

give the full path in the setting... make sure it is executable by www-data (or whatever user zm is running as).

On ubuntu, something like
sudo su -s/bin/bash -c"/home/zmadmin/script" www-data

Other than that.. if there was a failure it should be logged..
mrd
Posts: 269
Joined: Wed Apr 26, 2006 12:39 am
Location: Boston USA

Re: 1.37.5 run process on new event

Post by mrd »

Thanks!

Fixed with chown/chgrp to www-data, but I think the real problem was the log it was writing to was created the first time it ran as root.

Thanks for the help!
MRD
Post Reply