Cron Jobs & Queue Workers
FeedbackPulse SaaS uses Laravel's task scheduler for automated background work. Setting up the Cron-Job is essential for full functionality.
The Cron Job (Required)โ
What It Doesโ
The Cron-Job 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 Datenaufbewahrung policy |
digest:send | Daily at 8:00 AM | Sends daily/weekly E-Mail-Zusammenfassungs to tenant admins |
reports:send-scheduled | Daily at 7:00 AM | Sends geplante Berichte (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 Shared Hosting with cPanel:
- Gehen Sie zu cPanel โ Cron Jobs
- Set "Common Einstellungen" 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
Hinweis: 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
Sicherheit: 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:
- Navigieren Sie zu your panel's cron manager
- Add a new Cron-Job 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 Datenbank 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 Admin-Panel.
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