D
D
Dima_kras2019-05-31 09:17:18
linux
Dima_kras, 2019-05-31 09:17:18

Is there a software that saves the log, how to delete old logs from the folder?

Good afternoon, there is Rapsberry pi, there is software that saves logs (pictures), although there is a lot of memory, but someday it may run out.
There is a task to delete pictures old by date. Ideally, I want the log folder to be no more than 10-12 GB, the rest is deleted.
The idea is to write a Python script that will look at the size of the folder, and if the size exceeds 10 GB, delete the last 100 photos.
And run this script by cron every day.
But maybe there is a better solution?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
H
Hanneman, 2019-05-31
@Dima_kras

Use regular logrotate.

O
OnYourLips, 2019-05-31
@OnYourLips

logrotate with your config
https://askubuntu.com/questions/405663/configuring...

D
Dima_kras, 2019-05-31
@Dima_kras

As I understand it, logrotate controls the size of one file, such as time.log
And I have a \log\ folder that stores pictures 1-05-19.jpg, 2-05-19.jpg ...
And if the folder becomes more than 10- 12 GB, you need to delete old pictures.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question