Zmfilter.pl error erasing filesystem events

Support and queries relating to all previous versions of ZoneMinder
Locked
neouser
Posts: 8
Joined: Sat Sep 02, 2006 8:35 am

Zmfilter.pl error erasing filesystem events

Post by neouser »

Hello,

When you disable ZM_OPT_FAST_DELETE and execute a filter with AutoDelete option, zmfilter.pl failed when tries to run external rm -rf, lines 614 and 615 from zmfilter.pl:

Code: Select all

my $command = "rm -rf ".ZM_DIR_EVENTS."/*/".sprintf( "%d", $event->{Id} );
my $output = qx($command);
If ZM_DIR_EVENTS is default "events" this line is:

rm -rf events/*/number_of_event

This command failed because, before, zmfilter.pl has done a chdir to EVENT_PATH which is compound from ZM_PATH_WEB and ZM_DIR_EVENTS, lines 56 and 161:

use constant EVENT_PATH => ZM_PATH_WEB.'/'.ZM_DIR_EVENTS;
chdir( EVENT_PATH );

So rm failed because cannot to erase ZM_DIR_EVENTS from ZM_DIR_EVENTS.

A few days ago i did change my setup disabling ZM_OPT_FAST_DELETE, running zmaudit.pl each 6 hours and running zmfilter.pl with PurgueWhenFull filter and autodelete option when disk percent >= 96%. As zmfilter.pl was not erasing from filesystem, but was running each 6 minutes, when disk percent condition was true, zmfilter.pl began to erase from database but not from filesystem and disk percent condition continued true. When zmaudit.pl was executed, almost all my filesystem events were erased.

I have modified line 614:

Code: Select all

-my $command = "rm -rf ".ZM_DIR_EVENTS."/*/".sprintf( "%d", $event->{Id} );
+my $command = "rm -rf */".sprintf( "%d", $event->{Id} );
Now filesystem events are erased properly.


Note:

Nothing appears in zmfilter.log because -f flag in rm causes no output to STDOUT or STDERR.
A easy way to verify this issue is to change rm -rf to rm -r and manually execute zmfilter.pl when conditions are true.
Locked