Topic on Talk:Requests for comment/Proper command-line runner for maintenance tasks

Might be nice if maintenance tasks could recommend in the registry how often they are run?

3
Jdforrester (WMF) (talkcontribs)

Hard to do well, as most scale based on edit throughput, but an interactive tool of "hey, this one hasn't been run in a week, it's recommended to run daily, would you like this script to try to install a cron job for you?" might be helpful for smaller third party MediaWiki sysadmins?

Brooke Vibber (WMF) (talkcontribs)

Hard to say; I feel like most scripts only need to be run if something's unusual (to clean up errors or old bugs, or to do batch work that was skipped by a manual database import, or changing backends etc) or are task-oriented like resetting passwords and doing imports/exports.

Osnard (talkcontribs)

This is probably a little bit off topic, but yet I'd like to share:

In BlueSpice we have got some maintenance tasks that need to run periodically (e.g. "check for broken external links once a day", "create notifications for expired pages every week", "create a PDF report every month"). For this purpose we "hijack" the "runJobs.php" execution which we configure to happen every few minutes (using a cronjob). An extension can then implement a "RunJobsTriggerHandler". This handler can specify an "Interval" ("OnceADay", "OnceAWeek", ...). This Interval" is a PHP object, which therefore allows for static values (like "date of next sunday") or potentially dynamic values (that may depend on some state of the system. E.g "Send certain mails once a day, but only 100 at a time; Oh, there are 120 to sent today, so I will now send 60 and in 30 minutes send the rest. After that my next run will be tomorrow").

This way the only thing we need to setup is the cronjob that triggers "runJobs.php" at a certain frequecy. The extensions then will register their handlers and define their required intervalls.

See also

Reply to "Might be nice if maintenance tasks could recommend in the registry how often they are run?"