Automate your way to a good nights sleep

Mark O'Kane
4 min readJul 20, 2021

Automate, Automate, Automate… the technology equivalent of Location, Location, Location. I have done a huge amount of automation in my time, mostly scripting, and learned a lot via my own mistakes and from seeing other peoples’ work so I speak from pain and experience :).

Photo by Florian Olivo on Unsplash

Let’s start off with why you should automate. At its’ simplest, you should automate to free up your teams to work on the more important, higher value-add aspects of their role vs. having to constantly do repetitive and mundane tasks over, and over, and over again. No-one wants to do this and lose the will to live.

Automation comes with the added benefit of ensuring the task is done correctly each time by removing human error, so you will find your quality improves along with the increase in productivity and deliverables.

What to use for automation?? That can be anything from the humble Unix bash script to a stored procedure or a fully coded application. The choice is yours to suit your needs and the task you want to automate. There are loads of sites providing pre-existing scripts, libraries, and hints and tips so it would make sense to look at them e.g. CPAN (https://www.cpan.org/) for Perl, or PyPi (https://pypi.org) for Python… two of my favourites.

A few recommendations… I’m using the example of a script.

  • Make the scripts self-documenting so you don’t have to keep looking at docs to find out what the script does. Add a unique identifier so you can parse (e.g. grep in Unix) the purpose of the script to identify which one you need to run.
  • Build in fail-safes from the start to check every step of the task e.g. check your target system is working (ping the server or try to login), check the expected responses are correct, etc. If something fails, exit the script cleanly and generate a user-friendly error & log file entry. It’s important you know how far the task progressed before it failed in case you need to roll back something. If possible, implement automated rollback on failure.
  • Add debugging throughout and make it configurable regards the level… if something goes wrong, you’ll be thankful as will the next person. Make sure you generate logs at a bare minimum and time stamp them each time, so you do not overwrite important information.
  • Remember to include a help option if it has to be run manually.
  • Please, oh please provide informative error messages on the output console and in the log files. “Error 55” doesn’t cut it.
  • Very importantly… remember to think of the next person who will take over running or updating what you’ve written… create them so that person will have a warm fuzzy glow in their heart at your kindness versus cursing you to the depths of hell for the indecipherable mess you have created. If 10 lines will do it and it’s understandable vs. an unreadable 1 line of code, then do the 10. Remember… that person could be you.

When approaching automation for the first time, make sure you spend time upfront defining what you want to automate, why you want to automate it and most importantly, the benefits to doing the automation. When this is right in front of you, you get the full picture, and you could be surprised at what you’ve come up with and could gain from taking the time to automate.

Also check if there are existing scripts your operations or support teams have written that could be productised. There can be a pot of gold just waiting there to be used and save all involved time, effort, and cost.

As you progress with your automation, build up a library of reusable modules and functions to save time and make sure you share them with the team.

AI is increasingly becoming prevalent in automation. This can be in the form of providing recommendations for next best steps to support or operations teams based on previously applied corrective measures, or can indeed execute the automated correction of an issue. It’s worth taking a look at this if it suits your situation.

It’s sometimes hard for a company to decide to put the time and effort into automation due to pressures to deliver new products and features but performing at least an initial analysis of what could be automated and the benefits thereof should be done. I once spent two weeks talking to an operations team regards what they did when deploying a product and where automation could potentially help them. That two weeks lead to four weeks of task automation resulting in a reduction in deployment time of 3.5 weeks to 7 weeks on average and all the cost savings and reduction in frustration and human error that went with it.

I would highly recommend putting the effort in to automate where you can. It will save you time, cost and effort in the long run. You know you want to 🙂.

Have fun with your automation and sleep well.

--

--

Mark O'Kane

Lover of all things technology... and my pets... can't forget about my pets.