Abundant Scripting Is Good

I doubt there is any System Administrator out there who doesn’t realize that scripting is good, but I’ve found there are few who actually use scripting as I feel it should be used — as a way to programatically improve, simplify and automate many of the complex and tedious tasks of system monitoring and maintenance.

Any time you enter a complex command, or a series of commands, on the command line, you are wasting your time and introducing the possibility of serious errors.

My first rule is, if I have to do any task more than once, I’ll script it.  This applies especially if errors in the command can have serious consequences.

My second rule is, if I’m going to script it, I’m going to make it robust enough to be useful in all applicable situations.

My third rule is I never hard-code specific information in a script if I can help it.

Fourth is: If a script can figure something out, don’t require the user to enter it, or choose it or find it.

Fifth is: Document it!

I’ve heard “experts” claim that scripts above several hundred lines are just wrong.  I disagree.  Of course you wouldn’t use any interpreted scripting language for complex data processing, that would be the wrong language choice, but I’ve written scripts with thousands of lines that performed quite well and made my job much easier.

Scripts can be very slow, but often that is caused by poor scripting.  Utilities like grep, sort, awk, sed and so many others are there to do the heavy lifting.

I once took over from a System Administrator who worked solidly from 6am to midnight every day — without scripts, of course.  By the time I got done with my automation and simplification with scripts, I would regularly finish everything he had been doing in about 5 minutes.

Which meant I had a lot more time for all the important things, like security, enhancements, upgrades and planning.  And that extra time is the real value of abundant scripting.

Kimball

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: