Creating a Custom Scheduled Task in Moodle to Clean Up Old Log Entries
Learn how to create a Moodle scheduled task that runs periodic PHP code, with a concrete example for cleaning up old log entries, testing via CLI, and verification steps.
ReadMeFeed / Community knowledge
Real questions. Useful conversations. Find the people who know your stack.
Learn how to create a Moodle scheduled task that runs periodic PHP code, with a concrete example for cleaning up old log entries, testing via CLI, and verification steps.
A step-by-step guide to identify why Moodle cron does not run, apply targeted fixes, verify success, and know when to escalate.
Learn why WP‑Cron’s traffic‑dependent execution is fragile, how to replace it with a system scheduler, and what to check before and after the change.
Learn how Moodle’s activity completion feature replaces manual checks with automatic criteria‑based tracking, and see a concrete setup for a weekly reading‑quiz workflow.
Configure Moodle's cron system via PHP CLI and systemd timers for reliable background task execution. Covers manual verification, scheduling methods, task interval tuning, log monitoring, and recovery for stuck tasks or timezone mismatches.
Learn how to configure Unix cron jobs while avoiding common environment pitfalls, including path isolation, overlapping executions, and output redirection.
Learn how to enable Moodle activity completion, set a grade‑based condition on a Quiz, verify the storage in mdl_course_completions, and avoid common pitfalls.
After hardening an AlmaLinux 8 system with the CIS Security Benchmarks, a cron job that uses ack to search a log file returns zero matches, while the same command works correctly when run from an interactive shell. This causes monitoring or alerting scripts to fail. What explains this discrepancy, and how can the cron job be fixed while remaining compliant w
When running a Bash script that uses ack to search for patterns in a file, the script reports the expected counts when executed directly from an interactive shell on AlmaLinux 9. However, the same script invoked via a cron job returns zero counts, causing the conditional logic to fail. What causes this difference in behavior, and how can the script be modifi