I've built an app that uses cron jobs through Cloudways' built-in cron manager. While it works, it's a bit clunky and changes are tough since I have to log into the panel to edit jobs manually. I'm thinking about switching to a heartbeat pattern: having one cron job running every minute that triggers a script. This script would check a database or configuration for tasks, log activities, and execute any tasks that are due. This would allow me a more user-friendly way to manage the schedule through a GUI in my app. Is this heartbeat-style cron setup considered bad practice, or is there a more effective method for managing scheduled jobs in a flexible way?
2 Answers
Many frameworks already offer these types of facilities. In some cases, you can launch checks from a URL, allowing you to utilize whatever scheduler suits your needs best.
Yes, it's often considered bad practice because it can lead to unnecessary operations when nothing needs to run, wasting computing resources. Of course, whether that's a concern for you depends on your specific situation.
Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures