You are here

Mike Ciavrella's Scripting for Automation

Core Skills: Scripting for Automation was taught by Mike Ciavrella, a 12-year LISA veteran.

He created this class as a response to so many people he encountered who were automating because they knew it was a "best practice", and that they should "automate everything". Mike found that people didn't think about why they were automating, and he knew that was as important as actually doing the automation.

If I could provide only one take-home, it would be that automation is not scripting; scripting necessarily arises from automation, not the other way around. Don't build automation because you write scripts; write scripts because you're automating.

This class was divided primarily into two sections - first, establishing some guidelines and general best practices, and the second being practical, with a dive into shell scripts, which are commonly used in UNIX-like environments to automate processes. Mike postulates that there are four principles to automation:

  1. Visibility
  2. Logging must be built-in
  3. Idempotence
  4. Idempotence is the idea that repeating an action doesn't repeat the action - it guarantees that the action brings the system into alignment with policy
  5. Robustness
  6. Exceptions to the rule shouldn't leave the system in an unstable state. Make sure that the script cleans up after itself - both upon successful and unsuccessful termination, if at all possible.
  7. Automation is Abstraction
  8. Abstraction aids higher-level understanding but hides details

It's definitely beyond the scope of this blog entry to cover the scripting that Mike went over. I would recommend taking this class (or his Advanced Bash Scripting class) the first chance you get. In the meantime, you can pick up some good habits in your shell script in the Advanced Bash Scripting Guide.