adam121 - Fotolia
Advanced shell scripting for IT ops professionals: Free chapter
Shell scripts can improve speed and automation for sys admins beyond what's possible with graphical user interfaces. Dana French's books cover advanced shell scripting for experienced users.
Between every IT administrator and the end users they support lie miles and miles of code.
Most IT administrators are familiar, to some degree, with shell scripting. For the small set of administrators, site reliability engineers and DevOps professionals who immerse themselves in programming, IT consultant and trainer Dana French created a series of advanced shell scripting books.
Basic shell scripts can help get IT updates or monitoring tasks done quickly, said French, who runs SiteOx, a cloud service provider for non-Intel deployments, as well as Mt Xia Inc., an IT consultancy in Nashville, Tenn. Command of basic shell scripting opens an admin's eyes to the capabilities possible in data center automation, he said. They then progress on the job, getting better at writing scripts each time they need to create one.
"Getting from simple, easy shell scripts to enterprise-level shell scripting is ... a longer process," French said. "There's a leap from being a novice to being advanced -- it takes a while of writing short scripts, understanding the operators and what they do."
French developed a series of short books on advanced shell scripting techniques for administrators willing to stray from the point-and-click path. The first, Advanced Shell Script Programming for Business Continuity and Data Center Automation: Part 1: The Template, covers template creation, techniques to automate documentation and manage function libraries, coding conventions, and other topics.
One tenet of data center automation is that it occurs across all resources: local, privately hosted and deployed in public cloud, and any combination of the three. Programmers should account for distributed resources in their script construction. As stated in Chapter 1: Business Continuity thru Data Center Automation:
["Local/Remote Command Execution"] permits the shell programmer to write scripts that dynamically determine whether to execute commands on the local system, or on a remote system using a command execution tool such as "ssh". The technique involves writing the shell code in such a way that it becomes transparent to the shell script programmer whether the command is being executed locally or remote, as well as capturing the results.
Systems administrators can peruse the introduction and first chapter of the book here. Book two, Centralized Cloud Management, is slated for release this month. French plans to cover security in the context of advanced shell scripting in the third book, and a fourth is in the works.
While these books are written for experienced shell scripters who know syntax and how to use groups and traps and other script functionalities, French encourages all administrators to break away from strictly graphical user interfaces.
"I came into this industry at a time where systems administrators were also programmers," he said, adding that scripts not only make tasks easy and fast, they are the hidden gears behind every GUI. If you're not using shell scripts for automation, you risk falling behind competitors that can deploy IT resources faster, change direction effortlessly or divert workloads to avoid any damage from an outage.
Editor's note: This excerpt is from Advanced Shell Script Programming for Business Continuity and Data Center Automation: Part 1: The Template, authored by Dana French, self-published in 2016, ASIN: B01NCQ3717, ISBN: 978-1519083326, available on Amazon.