PurgeWhenFull nfs

Forum for questions and support relating to the 1.32.x releases only.
Post Reply
michael.schefczyk
Posts: 4
Joined: Mon Sep 30, 2019 9:29 pm

PurgeWhenFull nfs

Post by michael.schefczyk »

Dear All,

Using v1.32.3 on Debian Stretch and an nfs mount /zoneminder (permissions 755, www-data:www-data), included in a config file indicating this path under /etc/zm/, the UI does show a plausible space: "storage DB:16/151 Storage: Default: 77%, Default: 30% /dev/shm: 48%" means that 77 % of /zoneminder is full. Filters work in general, for example I can delete recordings with a startdate earlier than X.

What does not work is PurgeWhenFull. This does always evaluate "Default", not "Storage: Default". I did read many postings without finding a solution. Can someone please be so kind to indicate briefly how to proceed? If there is no way to get PurgeWhenFull working in this case, a script deleting content older than X days would also work. There, the challange seems to be to compute the relative date from scratch every time the srcipt runs.

Regards,

Michael Schefczyk
mikb
Posts: 586
Joined: Mon Mar 25, 2013 12:34 pm

Re: PurgeWhenFull nfs

Post by mikb »

michael.schefczyk wrote: Mon Sep 30, 2019 9:43 pmThere, the challange seems to be to compute the relative date from scratch every time the srcipt runs.
You need "find", a bucket of popcorn, and a read of the extremely detailed manpage for it :)

Something like (example only!)

Code: Select all

find /path/to/zm/events -type f -iname "*.jpg" -ctime +5 -delete
Would find all files, of extension .jpg, that were created more than 5 days ago, and deletes them without further warning.

So it's a very good idea to test things like this with -print instead, first, to see what matches, while you are setting up the rules.

Also look at options for -cmin (works in minutes, not days) -mtime -mmin (last modified times) and look at -daystart if you think your number of days isn't quite what you wanted. Good luck!
michael.schefczyk
Posts: 4
Joined: Mon Sep 30, 2019 9:29 pm

Re: PurgeWhenFull nfs

Post by michael.schefczyk »

Thank you very much. I am able to work with "find". If I delete just the files, DB entries will remain. I have zmaudit running in the background. Is that sufficient to ensure that the database gets cleaned up in due time?
mikb
Posts: 586
Joined: Mon Mar 25, 2013 12:34 pm

Re: PurgeWhenFull nfs

Post by mikb »

michael.schefczyk wrote: Wed Oct 02, 2019 4:22 pm Thank you very much. I am able to work with "find". If I delete just the files, DB entries will remain. I have zmaudit running in the background. Is that sufficient to ensure that the database gets cleaned up in due time?
Ideally, fix the problem with ZM, going on with find and nuking files is a sticking plaster, however ...

If ZMaudit is running, it will purge the database entries where files no longer exist, and v. versa.

I'm not sure if it will clean up any empty directories (depending on how your files are stored, there may be empty directories left behind by "find" -- that's a job for another find script :)

I use something like this for cleaning up empty (abandoned) directories in a non-ZM context :-

Code: Select all

find /mnt/place/base -type d -empty
Each time this runs, it will trim off the deepest empty directory only, so if a whole bunch of dirs of format ...

Code: Select all

/mnt/place/base/camera/month/day/hour/minute/second/*.jpg
... now contains nothing for a day, the first run of this "find" will remove the "seconds" directories that are empty, the next run will take out "minutes", etc. so don't expect an instant full cleanup: It will get there eventually :)
Post Reply