If you’re like me, you have a number of offline jobs running in your application. These jobs process images, send emails, warm up caches, and sync up data with 3rd-party APIs.
Also, if you’re like me, you run into the same problems over and over:
- Manually maintaining crontab files is a burden.
- Frequent jobs that stall or delay may start running multiple copies.
- Knowing when a job fails automatically is tough because honestly who has time to look at log files?
- If you have a webfarm, you have to decide which jobs run on which servers, or all of them.
Install a single crontab entry on each of your servers, and never edit crontab again. The master cron job runs a PHP file which contains all of your real jobs and executes them according to their individual schedules (using crontab syntax) along with other configs. The nice thing is that since
jobby is just PHP, you can decided what jobs to run and when programmatically. Now, I know there are more expansive server configuration tools out there, but those felt too heavy for this kind of use.
jobby will ensure only 1 copy of a job runs at a time, can email one or more recipients if a job fails, and can run as different users on select hosts.
I developed a version of
jobby years ago, and have brought it along with me on various projects, slowly tweaking it. It’s helped me immensely and if you’re interested, check out the README and
composer install away!