Running Moodle cron in devenv

I have a Moodle development project coming up and this is a good a time as any to experiment with setting up a Moodle environment in devenv.sh. One immediate issue is that Moodle depends on background tasks running almost constantly. Devenv has a set of supported services and cron isn’t one of them. Devenv does support the concept of processes, which are just background tasks. Can I apply that Techmint article on How to Schedule a Linux Job Without Cron?

Sure can:

1
2
3

processes.cron.exec = "while true; do php public/admin/cli/cron.php ; sleep 60 ; done";

As a bonus, the output will log to process-compose (see Moving from nix flakes to devenv for more on that). One gotcha: you should set Keep alive in Task processing to 0 otherwise the log gets spammed with cron retrying notices. You might want to disable that regardless, per the bug report I filed. The Moodle keep alive setting has unpleasant consequences if you’re hosting on AWS or somewhere else with a consumption model.