Skip to main content

⏰ Cron Jobs

PulseHub uses a cron runner (cron.php) to handle background tasks — polling email inboxes, processing automations, retrying failed webhooks, and cleaning up old data.


Overview

cron.php supports two modes:

ModeHow it worksBest for
Web URLCall cron.php?token=YOUR_SECRET&job=all via browser or hosting panelShared hosting (cPanel, Plesk)
CLIRun php cron.php all from terminalVPS / dedicated servers

Available jobs:

JobDescription
allRuns all jobs in sequence
emailPolls active IMAP email channels
automationsProcesses pending automation events
webhooksRetries failed webhook events
cleanupPrunes old SSE/automation/webhook events

Setup — Shared Hosting (cPanel / Plesk / DirectAdmin)

  1. Log in to your hosting panel
  2. Go to Cron Jobs
  3. Set schedule to Every Minute (* * * * *)
  4. Paste:
wget -q -O /dev/null "https://yourdomain.com/cron.php?token=YOUR_CRON_SECRET&job=all"

Or using curl:

curl -s "https://yourdomain.com/cron.php?token=YOUR_CRON_SECRET&job=all" > /dev/null 2>&1

Tip: Copy the full URL from Settings → Cron Job URL in PulseHub.

Option B: CLI-Based Cron

php /home/yourusername/public_html/cron.php all

Option C: External Cron Service

Use cron-job.org, EasyCron, or SetCronJob and point it at your cron URL. Set to run every 1–5 minutes.


Setup — VPS / Dedicated Server

* * * * * php /var/www/pulsehub/cron.php all >> /var/log/pulsehub_cron.log 2>&1

Job Details

email — IMAP Polling

Connects to all active email channels via IMAP, searches for UNSEEN messages, imports them as conversations. If imap extension is missing, the job logs a skip message and exits cleanly.

automations — Process Pending Events

Selects up to 100 pending events, evaluates rules, executes actions. Events are marked processing before evaluation to prevent double-processing.

webhooks — Retry Failed Events

Retries failed webhooks (up to 5 attempts within 24 hours).

cleanup — Prune Old Data

  • SSE events older than 24 hours
  • Processed automation events older than 7 days
  • Processed webhook events older than 30 days

Security

  • Web mode requires a secret token (generated during installation, stored in config/app.php)
  • CLI mode doesn't require a token
  • Token comparison uses hash_equals() to prevent timing attacks