Cron Jobs & Queue Workers
FeedbackPulse SaaS uses Laravel's task scheduler for automated background work. Setting up the tarea cron is essential for full functionality.
The Cron Job (Required)
What It Does
The tarea cron runs Laravel's scheduler every minute. The scheduler then decides which tasks to execute based on their configured frequency:
| Task | Frequency | What It Does |
|---|---|---|
feedbackpulse:trial-expiry | Every 6 hours | Restricts tenants whose free trial has ended without a paid plan |
feedbackpulse:usage-alerts | Daily at 9:00 AM | Sends email alerts to tenants approaching their plan's submission limit (90%+) |
data:enforce-retention | Daily at 2:00 AM | Deletes or anonymizes old submissions per retencion de datos policy |
digest:send | Daily at 8:00 AM | Sends daily/weekly resumen por correos to tenant admins |
reports:send-scheduled | Daily at 7:00 AM | Sends informes programados (daily/weekly/monthly) |
ai:detect-anomalies | Every 12 hours | AI-powered detection of unusual rating patterns |
Setting It Up
# Open the crontab editor
crontab -e
Add this single line:
* * * * * cd /var/www/feedbackpulse-saas && php artisan schedule:run >> /dev/null 2>&1
Explanation:
* * * * *— run every minutecd /var/www/feedbackpulse-saas— navigate to your projectphp artisan schedule:run— Laravel checks which tasks are due>> /dev/null 2>&1— discard output (logs go to Laravel's log file)
Verify It's Running
# List cron jobs
crontab -l
# Run manually to test
cd /var/www/feedbackpulse-saas
php artisan schedule:run
# Check the cron logs in the database (admin panel -> Settings)
cPanel Cron Setup
If you're on hosting compartido with cPanel:
- Ve a cPanel → Cron Jobs
- Set "Common Configuracion" to Once Per Minute
- In the "Command" field, enter:
cd /home/username/feedbackpulse-saas && /usr/local/bin/php artisan schedule:run >> /dev/null 2>&1
Nota: On cPanel, the PHP binary path might be
/usr/local/bin/phpor/usr/bin/php. Check withwhich php.
URL-Based Cron (Shared Hosting Alternative)
If your hosting panel only supports URL/wget-based cron (no CLI commands), FeedbackPulse includes a built-in web endpoint:
https://yourdomain.com/cron/run?token=YOUR_CRON_TOKEN
Setup:
- Your
CRON_TOKENis auto-generated during installation and shown on the completion page - You can also find it in your
.envfile:CRON_TOKEN=your_token_here - In your hosting panel's cron manager, add a new job:
- Frequency: Every minute (or every 5 minutes)
- Type: URL / wget / curl
- URL or Command:
Or with curl:wget -q -O /dev/null "https://yourdomain.com/cron/run?token=YOUR_CRON_TOKEN"curl -s "https://yourdomain.com/cron/run?token=YOUR_CRON_TOKEN" > /dev/null 2>&1
Seguridad: The
CRON_TOKENis a 64-character random hex string. Without it, the endpoint returns403 Forbidden. Never share this token publicly.
Where to find your token: Check the
.envfile for theCRON_TOKEN=line, or re-generate one by runningphp artisan tinkerand enteringbin2hex(random_bytes(32)), then updating.env.
HestiaCP / CyberPanel / CloudPanel
Most server panels have a "Cron Jobs" section:
- Navega a your panel's cron manager
- Add a new tarea cron with the schedule
* * * * * - Enter the command:
cd /var/www/feedbackpulse-saas && php artisan schedule:run >> /dev/null 2>&1 - Or if your panel supports URL-based cron, use the URL method described above
Queue Workers (Optional but Recommended)
By default, FeedbackPulse runs all jobs synchronously (inline with the web request). This is fine for small installations. For better performance at scale, you can run a queue worker.
When You Need a Queue Worker
- You have 50+ tenants
- Email sending is slow (blocks the UI)
- Webhook delivery is slow
- AI analysis takes too long
The Default Setup: Synchronous
In .env:
QUEUE_CONNECTION=sync
All jobs run immediately during the HTTP request. Simple but slower.
Upgrading to Base de Datos Queue
- Update
.env:
QUEUE_CONNECTION=database
- The queue table is already created by migrations. Start the worker:
# Start a queue worker
php artisan queue:work --sleep=3 --tries=3 --max-time=3600
- To keep it running permanently, use Supervisor:
sudo apt install supervisor
sudo nano /etc/supervisor/conf.d/feedbackpulse-worker.conf
[program:feedbackpulse-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/feedbackpulse-saas/artisan queue:work database --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/feedbackpulse-saas/storage/logs/worker.log
stopwaitsecs=3600
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start feedbackpulse-worker:*
Upgrading to Redis Queue (Best Performance)
- Install Redis:
sudo apt install redis-server php8.2-redis
- Update
.env:
QUEUE_CONNECTION=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
- Set up Supervisor (same as above, replace
databasewithredisin the command)
Monitoring
Check Cron Execution
FeedbackPulse logs all cron executions to the cron_logs database table. You can view these in the panel de administracion.
Check Queue Status
# See pending jobs
php artisan queue:monitor database:default
# See failed jobs
php artisan queue:failed
# Retry a failed job
php artisan queue:retry {job-id}
# Retry all failed jobs
php artisan queue:retry all