Prompt
How do I run background jobs on my hosting provider?
Latest observation
Oct 7, 2026
OpenAI APIWeb search: off
It depends on what kind of hosting you have. “Background jobs” can mean very different things, and not every hosting provider lets you run them the same way.
Common ways to run background jobs
1) Cron jobs / scheduled tasks
Best for: periodic work like cleanup, email digests, reports, syncing data.
- On cPanel/Plesk/shared hosting, this is usually the normal way.
- You set a command to run every minute/hour/day.
- Example:
php /home/user/app/artisan schedule:runpython /home/user/app/script.py
2) Long-running worker/process manager
Best for: queue workers, async jobs, chat bots, webhooks, consumers.
- On VPS/dedicated servers, you usually run a worker under:
systemdsupervisordpm2for Node.jsforeveror Docker restart policies
- Example:
php artisan queue:workpython worker.pynode worker.js
3) Built-in platform jobs
Best for: managed platforms like Heroku, Render, Railway, Fly.io, etc.
- Many providers have a separate “worker” service type.
- You deploy your app and a separate worker container/process.
4) Serverless/background task services
Best for: cloud-native apps.
- Use:
- AWS Lambda + EventBridge
- Google Cloud Functions/Cloud Scheduler
- Azure Functions
- Good for short tasks, not long-running processes.
Important hosting limitations
If you’re on shared hosting, you often cannot keep a process running forever. In that case:
- Use cron to trigger scripts periodically.
- Use the provider’s task scheduler if available.
- Offload real background work to a queue service or another server.
Typical setup patterns
If your app has a job queue
- Web app adds jobs to a queue.
- A worker process pulls jobs and executes them.
- A cron job or supervisor ensures the worker stays alive.
If you only need periodic execution
- Create a script.
- Register it in cron.
- Log output to a file for debugging.
Example cron entry:
*/5 * * * * /usr/bin/php /home/user/app/cleanup.php >> /home/user/logs/cleanup.log 2>&1
If you tell me your provider, I can be specific
If you share:
- hosting provider name,
- whether it’s shared hosting, VPS, or managed platform,
- and your language/framework,
I can give exact steps and commands for that platform.