Due to local laws we are required to purge surveillance videos after a period of max. 72 hours. This is the time frame in which we are able to detect any vandalism or theft (which is the purpose for our video surveillance). During extended weekends e.g. over the easter holidays this time frame is of course longer. Now it is fairly easy to have ZoneMinder purge unarchived videos after 3 days, the question is how do I prevent this filter from running during holidays?
I already have two runstates, nighttime and daytime (the monitors are set to modect during nighttime and to monitor during daytime). On weekdays I use cron to switch between nighttime and daytime using a shell script that checks for holidays. My initial intuition was to use the runstate as a filter condition which would prevent ZoneMinder from deleting stuff during the holidays. But after a long weekend the action would still run and purge events BEFORE any staff members arrive. Unfortunately the system time is no filter condition. Does anybody have an idea how to delay the filter until after 3:00 pm or so? Or is there a way to use a cronjob to trigger the filter?
Run filter after a certain time of day
Re: Run filter after a certain time of day
You can use cron job to run the filter. Don't check the run in background box .. then in cron job run zmfilter.pl --filter_id=[whatever the id is]
You could also sponsor the addition of the needed conditions in the filters...
You could also sponsor the addition of the needed conditions in the filters...
-
- Posts: 7
- Joined: Sun Jun 14, 2015 3:32 pm
Re: Run filter after a certain time of day
This is an old thread, I know, but I'm running zmfilter.pl in crontab to remove events with fewer than a couple of alarm frames, and I cannot for the life of me get it to output the results to a log. A log is not critical, but I'm just wanting to see that the filter is working. Any hints about how to write a line in crontab that will output to a log? Thanks.
Re: Run filter after a certain time of day
At the simplest, if zmfilter.pl writes output to stdout, it would be mailed to the user that invoked it from cron.denver_compdoc wrote: ↑Sat Jan 27, 2024 12:21 am This is an old thread, I know, but I'm running zmfilter.pl in crontab to remove events with fewer than a couple of alarm frames, and I cannot for the life of me get it to output the results to a log. A log is not critical, but I'm just wanting to see that the filter is working. Any hints about how to write a line in crontab that will output to a log? Thanks.
Or, you could redirect it's output to a logfile yourself in cron, with
Code: Select all
/path/to/zmfilter.pl --filter_id=myfilter >> /path/to/logfile.txt
One option -- which I would do -- is to run a script of your own making from crontab. i.e. not call zmfilter direct.
Then, you can log whatever you want just before, during (if it outputs things to stdout), or after. Lots more options ...
e.g.
Code: Select all
#!/bin/tcsh
echo -n "About to do a thing at "
date
/path/to/zmfilter.pl --filter_id=myfilter
echo -n "I did the thing at "
date
Code: Select all
/usr/local/bin/yourscript >> /usr/local/etc/yourlogfile.txt
Re: Run filter after a certain time of day
Which user are you running it as? zmfilter normally runs as www-data, and should log to /var/log/zm/zmfilter_[filterid].log
-
- Posts: 7
- Joined: Sun Jun 14, 2015 3:32 pm
Re: Run filter after a certain time of day
I stopped trying with cron and enabled the filter to run in the background. It took some time, like maybe one or two days before it began logging to zmfilter_4.log, but now it does.