Cron Jobs
Every script here is a plain PHP CLI script — run with php /path/to/project/scripts/whatever.php,
no web server involvement, no arguments needed for any of them. Each is idempotent (safe to run twice
in a row without duplicating anything or double-charging anyone) unless noted otherwise.
On shared cPanel hosting, set these up under cPanel → Cron Jobs, pointing at the full path to your
PHP binary and the script. On a VPS or other server, add them to crontab -e directly. Both are shown
below.
The scripts
You don't have to type these: Super Admin → System & licence → Scheduled jobs (and the installer's last screen) lists every job with the exact command for your server and a Copy button.
| Script | What it does | Suggested schedule |
|---|---|---|
verify_license.php |
New in 2.0.1. Re-checks the licence once a day so its status stays fresh on quiet sites. Never pauses anything itself. | Daily |
process_outbox.php |
New in 2.0. Sends queued emails and SMS and retries failures (after 5 min, 30 min, 2 h). Without it, bulk sends such as invoices and reminders stay queued. | Every 5 minutes |
mark_overdue_invoices.php |
Flips subscription_invoices from pending to overdue once due_date passes. |
Daily, early morning |
generate_term_invoices.php |
Generates that term's subscription_invoices for every active, full-platform school, based on each school's own subscription_plans.term_length_months. |
Once per term (manually triggered is fine too — see note below) |
mark_overdue_library_loans.php |
Flips library_loans from active to overdue once due_date passes. Cosmetic status only — the return workflow and fine calculation both work the same regardless of whether this has run. |
Daily |
send_attendance_alerts.php |
Sends a notification (SMS/email, via NotificationService) to guardians when a student is marked absent that day. |
Daily, after the school day's attendance is expected to be marked (e.g. mid-morning) |
send_fee_reminders.php |
Sends a reminder to guardians whose student_fee_balances.due_date is approaching or has passed. |
Daily |
Demo edition only: demo_reset.php rebuilds the demo every night (0 0 * * *). It refuses to run on
a standard installation because it wipes the database.
On generate_term_invoices.php: unlike the others, this one doesn't need to run on a fixed
daily cadence — it makes sense once per term (e.g. the start of each term), and running it twice for
the same period is harmless (it's driven by each school's actual term dates, not a blind "run every N
days" assumption) but also pointless. Many operators will prefer to trigger this manually via SSH/cron
run-once rather than scheduling it — either is fine.
Example crontab (VPS / any server with real cron access)
# Solvo — adjust the PHP path and project path for your server.
*/5 * * * * /usr/bin/php /var/www/mojamoza/scripts/process_outbox.php >> /var/log/mojamoza-cron.log 2>&1
0 1 * * * /usr/bin/php /var/www/mojamoza/scripts/mark_overdue_invoices.php >> /var/log/mojamoza-cron.log 2>&1
0 2 * * * /usr/bin/php /var/www/mojamoza/scripts/mark_overdue_library_loans.php >> /var/log/mojamoza-cron.log 2>&1
0 9 * * * /usr/bin/php /var/www/mojamoza/scripts/send_attendance_alerts.php >> /var/log/mojamoza-cron.log 2>&1
0 10 * * * /usr/bin/php /var/www/mojamoza/scripts/send_fee_reminders.php >> /var/log/mojamoza-cron.log 2>&1
# generate_term_invoices.php: run manually at the start of each term, or uncomment for a quarterly nudge
# 0 3 1 1,4,9 * /usr/bin/php /var/www/mojamoza/scripts/generate_term_invoices.php >> /var/log/mojamoza-cron.log 2>&1
Find your PHP binary's path with which php (VPS) — shared hosts usually give you a specific path in
their control panel instead (see below).
cPanel — Cron Jobs UI
For each script, add a cron job with:
- Command: /usr/local/bin/php /home/YOURUSER/mojamoza/scripts/mark_overdue_invoices.php (cPanel's
Cron Jobs page usually shows your exact PHP path near the top of the form — use that, not a guess)
- Schedule: pick from the dropdowns matching the table above (e.g. "Once a day" for the daily ones)
Repeat for each script, one cron job entry per script. Put only the command in cPanel's Command box; the timing goes in the Minute / Hour / Day / Month / Weekday boxes.
Verifying a cron job actually ran
Every script prints a short summary line to stdout when it finishes (e.g. "Marked 3 loan(s) overdue.").
If you redirected output to a log file (as in the crontab example above), check that file. If a cron
job silently does nothing every day, the most common cause on shared hosting is the PHP path being
wrong — cPanel often has multiple PHP versions installed under different paths, and cron doesn't use
the same PATH your shell does.