Cover image for project: NEXUS Cronjobs IN PROGRESS

Technical summary

NEXUS Cronjobs is the server's single scheduling hub: it discovers jobs declared in each active plugin's cronjob.json, dispatches ticks via soft-cron (worker.php/cron.php/run_cron) and schedules custom CLI commands through an allowlist. It runs via nx_secure_exec_status and creates tasks from job runs.

Executed scope

  • Plugin registration (registerTab('nexus-cronjobs','Cronjobs','clock',tab.php,'Admin & Ops') + registerDoc) and cronjob.json as a declarative job manifest (same spirit as fastr.json).
  • 7 API actions: cronjobs_list (catalog + custom + plugin_catalog + stats), cronjobs_save (schedule edited via functions.save), cronjobs_run (on-demand run), cronjobs_custom_{save,delete} (CLI job CRUD) and cronjobs_runs/cronjobs_tick (history and soft-cron dispatcher).
  • Persistence via DB config (no own tables): plugin.cronjobs.jobs (custom, upsert), plugin.cronjobs.runs (history, max 80) and plugin.cronjobs.meta.
  • Security and allowlist: cronjobs_resolve_command() validates the path against (?^plugins/[a-z0-9_-]+/.+\.php$ | cron/*.php | worker.php$) via realpath, rejects ../null/space and confirms the prefix stays inside root.
  • Workers/cron (soft-cron): cronjobs_tick() iterates jobs with tick:true calling functions.check, then cronjobs_run_custom_due() fires custom jobs whose next_run <= now and reschedules (cronjobs_calc_next_run: hourly/daily/weekly/monthly); production recommends an hourly crontab on worker.php (or cron.php/run_cron).
  • Execution: cronjobs_exec_custom() and cronjobs_run_discovered() resolve command→path and run via nx_secure_exec_status([phpCli, $path]) (PHP bin from cronjobs_php_cli), log the result in cronjobs_run_log and update last_run/last_status/next_run.
  • UI (tab.php, 567 lines, Alpine cronjobsApp()): header with clock icon + crontab recommendation badge; "Production" callout; stat cards (Active/Next 24h/24h failures/Last tick); 3 tabs — Jobs (manifest catalog, plugin filter, active/off badges), Custom (CLI CRUD with plugin + job picker → hub-resolved path, frequency/time schedule) and History (paginated runs with ok/error status).
  • Integrations: Backup, Email OSINT, Pipeline Control and worker plugins expose jobs via cronjob.json; the hub is the single orchestrator (no duplicate scheduling per plugin).

Stack and tools

  • PHP 8 (backend, no framework) + MySQL 8 (admin_configs store)
  • nx_secure_exec_status for CLI jobs with resolved PHP bin (/usr/bin/php, fallbacks /usr/bin/php8.x)
  • OS crontab scheduling worker.php/cron.php/run_cron (soft-cron; no built-in daemon)
  • Alpine.js + Tailwind (tab.php, no assets/ or design.css)
  • Internal Plugin API (PluginManager tabs/actions + declarative cronjob.json)

Operational tags

  • Cronjobs
  • Scheduling
  • Soft-cron
  • Tick
  • Worker
  • Custom CLI
  • NEXUS Plugin

Operational result

  • Declarative discovery: each plugin exposes jobs in plugins/<slug>/cronjob.json; the hub scans only active plugins and builds a unified, ID-deduplicated catalog.
  • Soft-cron with tick + custom: cronjobs_tick() runs checks of tick:true jobs (backup, email_osint, pipeline) and fires custom jobs by due-time; schedules support hourly|daily|weekly|monthly + HH:MM.
  • Security allowlist: no path is typed by the user — a picker lists plugin + job/CLI and the hub resolves the PHP via realpath against plugins/*/…, cron/*.php and worker.php.
  • Isolated execution: scripts run via nx_secure_exec_status (no shell) with a resolved PHP binary, captured output and run logging.
  • History and stats: up to 80 runs in plugin.cronjobs.runs + stats (active, next 24h, 24h failures, last tick); plugins without cronjob.json show as "no CLI".
  • Custom CLI from the panel: create/edit/delete jobs without touching the server — the path is resolved by the hub from the selected plugin.

GitHub progress (issues)

Real-time panel with latest repository issues.

abertas (amostra): -- fechadas (amostra): -- base: -- ultimas issues

carregando andamento...

Real results

Advanced scheduled task manager and background cron execution system. Enables configuring standard cron expressions, tracking execution histories, auditing logs and runtimes, and automating scheduled maintenance across the NEXUS ecosystem.

Architecture and organization

Execution and operations

The project follows reproducible execution flow with technical validation in production-like environments.

Screenshots

Talk about this project

Apply this implementation pattern in your environment and accelerate delivery with technical consistency.