photo 1509248961158 e54f6934749c

Systems and Processes that Aren’t in Code are Terrifying

The dreaded:

15 6 2 1 * /home/lane/

You may recognize this as a unix cronjob, a job that is scheduled to run on a server periodically.

You may be thinking,

“Why is that scary? We use cronjobs all the time!”

If the code that manages the crontab is source controlled and exists within the organization’s central repositories, then I actually have very little to complain about. My beef is when an engineer hops into the server and starts up a cron job without that configuration existing anywhere in code.

You may say,

Well, the cron schedule may not exist in code, but the script/program it runs does!

I don’t care.

gordon ramsay

I want to be able to look at the code base and know if the program is long-running, should be run manually, or if it runs on a specific schedule. It is fine if it’s going to be run using crontab. We just make sure that the CI/CD config file (or something similar that is source controlled) specifies how that is triggered.

Or even better, program in Go so that spinning up side processes within your app is simpler than using the crontab 😉

Other Angst-y Things

Crontabs are just a common example of hard to discover processes. Others, for example, may include:

  • Database processes that were added manually, instead of by the app that owns the DB
  • .bash_profile or .bashrc files that kick off server startup jobs
  • Third party apps that were installed on the server to take care of special tasks (I don’t know, defragging the disk maybe). Those processes should be documented in code, probably config files that your organization typically uses to start its apps.

Internal documentation certainly sucks, so document your processes in code instead. A config file that specifies how a process is started is much better than a PDF, because the config file can’t become outdated (if it does, things break).

More life-saving tips for your coding life:
Purity in my Programming Please
Don’t Go To Casting Hell; Use Default Native Types in Go
How to: Global Constant Maps and Slices in Go

Thanks For Reading!

Follow us on Twitter @q_vault if you have any questions or comments

Take some coding courses on our new platform

Subscribe to our Newsletter for more programming articles

%d bloggers like this: