Database optimization always on thursday?

Maybe this is one for @ChuckPa

How does the butler plan weekly scheduled tasks (for example DB optimizing, clear bundle removing old cache files)? On my server Plex does it on thursday. Is this a plan by week days or does it rely on the day of the first installation? I’m asking because I want to let your DBRepair script run after Plex has finished the database maintenance.

I’ve never asked but mine runs on Tuesday so it would make sense to be based on date of installation.

I can find out if you want.

Yeah, this would be nice but no need to hurry. :grinning_face:
I just realised that the database tasks are the one that take the longest time, Usually the optimize database, clean bundle and collect blob garbage are done pretty quick. The removing of old cached files usually take significantly more time but I think this is because of the high number of single files (it often removes 10’000+ files).

Speaking of scheduled tasks (a bit off topic): :wink:
Remember the problem we’ve talked a couple of months ago with mixed language? Some of the tasks are still in english. Most of them containing the scanning tag. Just to let you know… :memo:

03:11 Der Butler hat die Datenbank gesichert.
03:07 Der Butler hat die Datenbank gesichert.
03:00 Verbindung zu Whydah hergestellt, wartet auf Ereignisse.
03:00 Kann keine Ereignisse auf Whydah empfangen.
02:57 Library scan complete: Extra information may still be downloading from the Internet
02:57 Scanning Super Bowl LIX - Kansas City Chiefs vs Philadelphia Eagles (2024-25)
02:57 Scanning the "Misc 2 (no Metadata)" section
02:52 Library scan complete: Extra information may still be downloading from the Internet
02:52 Scanning Super Bowl LIX - Kansas City Chiefs vs Philadelphia Eagles (2024-25)
02:52 Scanning the "Misc 2 (no Metadata)" section
02:19 Library scan complete: Extra information may still be downloading from the Internet
02:19 Scanning Super Bowl LIX - Kansas City Chiefs vs Philadelphia Eagles (2024-25)
02:19 Scanning the "Misc 2 (no Metadata)" section

Last time I looked the schedule was based on when pms starts. Just restart pms on the day you want it to run. It should run that night then weekly on the same day.

@ChuckPa
Do you have any news about this? :grinning_face:

@Fluamsler

Apologies, This fell off my to-do list.

Just looked in code and confirmed, YES, it’s 3 days from when PMS starts.

While I’d like to be able to set specific days for backup, It didn’t survive the viability discussion.

@ChuckPa

So does this mean if I stop Plex for a week and start it on Sunday again the task DB maintenance would be moved to wednesday?

That brings me to another question: Because DSM on my DS224+ slowly uses more RAM over time I stop Plex every saturday at 12 PM for 3 minutes via scheduled tasks and start it again. But my “DB task” (optimizing DB, cleaning bundles and so on) runs on Thursday. I guess this does not count as restart?

Use Hours to make the math easier –

Start at midnight Sunday. 72 hours later, the maintenance will flag as being due.
When Scheduled Tasks run, the DB backup / maintenance will run.

If you do anything manually before then, it doesn’t count toward the trigger counter.

@ChuckPa
Maybe we were not talking about the same. :wink:
I didn’t mean the database backup. I mean the Database Optimization/Clean Bundles and Remove Temporary Files which only happens once a week.
Since I’ve installed Plex this task always runs on Thursday (you said yours is on tuesday) and I don’t understand why it has to be a Thursday here. :wink:

The only thing I do on my server is stopping Plex every now and then for an Update or maybe a power outtake about once a year (after the UPS shuts it down).

About the DB backups.: Yes, they run every three days. :grinning_face: I’ve checked the backups in the Plex Folder and these files are from:
Tuesday 30th,
Saturday 27th
Wednesday 24th and
Sunday 21th of September.

So that matches with the 72 hours (and the change of days because you can’t divide 7 through 3 without leftovers)