commit 57cedec52c0f9de418e0f46733bd14fc0aeda498
parent 55833e1d10588c249f6bdebcffa9af79aa9964e3
Author: JayVii <jayvii[AT]posteo[DOT]de>
Date: Sat, 27 Apr 2024 10:19:31 +0200
Improve instructions for cleanup job
The previous cleanup instructions would delete every single audio file every 7 days, regardless of when they have been downloaded. The new logic is invoked every day and deletes every audio file that is older than 7 days.
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
@@ -62,7 +62,7 @@ Duration times of entries are unknown until they have been downloaded. The podca
### The webroot grows bigger / old episodes are never removed from the server
-The script will never "cleanup" audio files from the webdir root directory, after they have been downloaded by the client. Depending on your usecase scenario, it might be a good idea to setup a cronjob for that:
+The script will never "cleanup" audio files from the webdir root directory, after they have been downloaded by the client. Depending on your usecase scenario, it might be a good idea to setup a cronjob for that. The example below will look every night at 00:00 for `.opus` files in the web-directory (in this example `/var/www/yt2rss`, adjust accordingly) that have been created (downloaded) over 7 days ago.
```cron
# |----------- minutes
@@ -77,5 +77,5 @@ The script will never "cleanup" audio files from the webdir root directory, afte
# | | | | |
# | | | | | |- command
# | | | | | |
- 0 0 * * 1 rm /var/www/yt2rss/*.opus
+ 0 0 * * * find /var/www/yt2rss/ -type f -name "*opus" ! -newermt $(date +%Y-%m-%d --date "-7 days") -exec rm {} \;
```