Koovira Dev Docs
30-core/cron-background.md

Cron & Background Processes

Status: ๐ŸŸข Production ยท Last validated: 2026-09-06

Non-user-triggered work. 117 scripts in cron/. They are plain PHP run headless (php cron/x.php) โ€” which means they boot via the local/CLI branch of coredb.php (see ../00-architecture/bootstrap-and-config.md) and get a KVGuardedPDO (DDL still blocked). Validated by listing cron/ + reading names.

Scheduling lives on the server, not in git โ€” there is no crontab file in the repo. The actual schedule (which script runs how often) must be read from the server crontab; document it there and mirror the cadence here as it's confirmed. Treat cadence below as category, not confirmed timing.

Categories (representative โ€” not exhaustive)

Money / settlement (highest care)

commerce_settlements.php, kv_settlement_run.php, fitness_settlements.php, vehicle-wallet-settlement.php, freelance_escrow_settlement.php, services_escrow_settlement.php, legal_escrow_settlement.php, truck_escrow_settlement.php, events_crm_escrow_settlement.php. These move real money (escrow โ†’ provider, platform settlement). Read ../40-financial/commission.md before touching any.

Wallet integrity

wallet_deleted_sweep.php (orphaned balances โ†’ holding user), wallet_earned_expiry_sweep.php (expire earned credit), wallet_ledger_drift_alert.php (reconciliation alarm).

Membership / billing

kv_membership_cycle_rollover.php, send_membership_renewal_reminders.php, send-renewal-reminders.php.

Notifications / marketing delivery

email_queue_processor.php (drains email_queue), daily_summary_emails.php, marketing_drip_worker.php, marketing_scheduled_campaigns.php, social_media_publisher.php, send_delayed_otp.php, wa_template_sync.php, send_contact_invites.php.

Order/ops reminders

commerce_order_ready_reminders.php, classified_escrow_ready_reminders.php, food_order_status_reminders.php, commerce_vendor_acceptance.php, commerce_escalations.php, smanager_dues_reminders.php, truck_document_expiry.php.

Moderation / risk / security

moderation_worker.php, moderation_review_scan.php, moderation_case_window.php, ai_risk_worker.php, security_watch.php, revoke_zero_doc_kyc.php.

Cleanup / maintenance

cleanup_auth_logs.php, cleanup_auth_sessions.php, cleanup_logs.php, session_maintenance.php, user_activity_cleanup.php, analytics_retention_cleanup.php, privacy_data_retention_cleanup.php, website_cache_gc.php, account_identity_purge.php.

External sync / ingest

hotel_*_sync.php (Agoda, Brevistay, EMT, Ixigo), property_magicbricks_sync.php, dmart_price_sync.php, croma_enrich.php, ecommerce_platform_sync.php, courier_tracking_sync.php, compare_price_alerts.php, search_reindex.php, sync_google_contacts.php.

Async workers (queues)

video_worker.php, translation_worker.php, process-media-queue.php, sftp_worker.php, courier_booking_processor.php, website_export_queue.php, website_sitemap_generator.php.

Scheduler engine

scheduler_reminders_run.php, scheduler_webhooks_run.php, global_schedule_reminders.php.

Health / ops

db_health_check.php, uptime_monitor.php, probe_timezone_drift.php, koovira_server_restart_worker.php.

Privacy / reporting

privacy_data_export_worker.php, monthly_credit_report.php, golive_progress_email.php.


โš ๏ธ Test / smoke scripts โ€” must NOT be in the prod crontab

test_.php (test_food_delivery_otp, test_freelance_hold, test_multivendor_cart, test_quick_commerce_gate, test_fitness_settlement, test-cab-radius, test-hotel-wallet-flow, test_address_gateโ€ฆ), smoke_.php (smoke_run_all, smoke_actions, smoke_caseโ€ฆ), uat_drive_.php, refund_order_153.php, refund_multivendor_test_orders.php, seed_faq_multivendor_.php, set_classifieds_commission_default.php. These are dev/QA/one-shot scripts; several move money or seed data โ€” verify none are scheduled on prod.

Per-cron documentation template (fill as confirmed)

Trigger โ†’ Frequency (from server crontab) โ†’ Script โ†’ Tables read โ†’ Tables updated โ†’ Failure handling โ†’ Retry. Two known money crons to expand first: commerce_settlements.php, kv_settlement_run.php.

Change-impact

Cron changes are invisible until they run and often touch money. Re-test any settlement/sweep on a copy; confirm the schedule on the server; never let a test_/smoke_ script into the prod crontab.