djdd87 / SynoAI

A Synology Surveillance Station notification system utilising DeepStack AI
GNU General Public License v3.0
213 stars 24 forks source link

Automatically delete images after a certain timeframe #19

Closed djdd87 closed 2 years ago

djdd87 commented 3 years ago

From reddit comment:

  1. Another enhancement could be to delete the pictures folder after X number of days.
AlexanderSch90 commented 3 years ago

a little Workaround: Install the Docker Image ofelia and make a job like:

[job-exec "synoai delete"]
schedule = @every 3h
container = synoai
command =  find /app/Captures -iname "*" -mtime +14 -delete
JohannCR commented 3 years ago

@AlexanderSch90 Nice workaround, thanks. Can you explain the command ? Say if I want to clean up every month all captures older than 30 days would that work ?

[job-exec "synoai delete"] schedule = @monthly container = synoai command = find /app/Captures -iname "*" -mtime +30 -delete

AlexanderSch90 commented 3 years ago

Sure but monthly + 30 days is nearly 2 month. I would use @daily

JohannCR commented 3 years ago

@AlexanderSch90 coming back for some help, I cannot make ofelia work... Seems like a socket issue but I don't what what to do with this suggestion, can you help ? Thanks

AlexanderSch90 commented 3 years ago

I think it is a Problem with Synology Docker. I run this on an Real Docker Server. Sry no idea...

JohannCR commented 3 years ago

Found another way to do it using the synology task scheduler. For those who need it here is the command used :

find /volume1/docker/synoAI/captureDir -type f ! -mtime -30 -exec rm {} \;