All novice Linux users and seasoned sysadmins know that Cron is a great simple solution to the problem of regularly calling the same application, it is present in almost every Linux system, has simple syntax and a number of logging and warning functions that make it a great addition to system administrator tools.
However, the Cron solution has some limitations.
- The minimum time is limited to 1 minute – this is the shortest repeating interval that you can configure.
- Minimal support to avoid concurrency.
- It almost completely ignores the state of the command being called, that is, if the script fails, Cron will just keep trying (as it should), and you, as an administrator, should check and diagnose the problem.
- But what if you need to implement a robust “long-lived” application in Python or PHP?
Not everything can fit into convenient 1-minute time intervals for program code execution. In addition, there is an unnecessary overhead for loading the required libraries and opening file and socket descriptors each time the program is called for execution.
What if your application code needs to maintain a connection to a remote server and respond to events on an ad-hoc basis? Probably someone will say that these are already full-fledged demon programs. But the line between a daemon and a long-lived application in scripting languages is not very clear.
“Long lived Python/PHP daemon-script-wrapper with Supervisor instead Cron schedules”Continue reading