
Cronjob imitating service
This one is a personal hatred of mine. A developer needs a service to run indefinitely, so they just enable a cronjob that never ends, or simply have a cronjob that operates incredibly frequently (such as once every few seconds).
A cronjob is a scheduled job that will run at a predetermined time. It's not something that operates services for you. Not only is this messy from an architectural perspective, but it scales horribly and becomes terrible to monitor.
A constantly processing task should be treated as a daemon and not as something that runs on the basis of a cronjob.
Monit is a tool in Linux systems that allows you to imitate services.
You can install Monit using the apt-get
command:
sudo apt-get install monit
Once Monit is installed, you can add processes to its configuration file:
sudo nano /etc/monit/monitrc
Monit can then be started by running the monit
command. It also has a status
command so you can verify it is still running:
monitmonit status
You can learn more about Monit and find out how to configure it at http://www.mmonit.com. It is a highly valuable tool for every DevOps focused developer to have in their armory.