So in my efforts of being lazy, because I think all Linux administrators should strive to be lazy (more on that later). I have decided to start a blog. This will be a place where I will use as a general dumping ground for thoughts, fixes, maybe even discussions. Reason being, sometimes I find a problem that makes me scratch my head… that issue may make others scratch theirs also! Once I find a fix for it, then it would be nice to have it out there on the internet somewhere so that others can benefit from my journeys… There will also be times that I come up with a neat trick that others may be interested in, and it would be nice if they could find it, and it would also be nice if I could point them somewhere for instructions rather than having to walk them through it every time.
I think the topic for this first post will be why I feel that all Linux admins are, and if not, should be LAZY! In Linux we have these wonderful scripting languages… bash, python, perl as well as others. The nice thing about them is that whenever you use one to do something, it does it the exact same way… every time… While a good Linux admin should be more than capable of doing it on their own, the problem comes when you have a whole team of admins, all doing it on their own. Everyone has “their way” instead of doing it “the way”. That isn’t to say that “the way” is the best method, but it is good to have a method that everyone uses. That way if I set up something on a system, then someone jumps on that system later, they are familiar with how it is set up, and how it is controlled.
The other nice thing about scripting things is something I already mentioned, but didn’t expand on yet. They do it the exact same way, EVERY TIME. This means that you take out the chance for human error, or PEBKAC (Problem Exists Between Keyboard And Chair). Many commands in Linux can be dangerous if used incorrectly, almost any Linux admin will know that a typo while using `dd` can wipe out all of the data on a hard drive. If it is scripted, then you can also script in checks to make sure that doesn’t happen.
Oh, and the lazy part… once it is scripted, you can do the entire task in one (typically short) command and let it run… instead of running command after command after… you get the idea…
That said, there are good scripts, there are bad scripts. Not every script is safe, not every script is formatted well. Part of writing a good script is writing it in a method where someone else can come by later, look at the code in it, and know what it does… making a change if needed. But good scripting is more of a topic for a later post.
If anyone has a topic that they would like me to cover, let me know! Leave it as a comment to this post, or you can catch me on IRC. I am typically on irc.freenode.net with the nick cryptk. I run a bouncer so even if I am not there, I will get the message next time I log in! (Hey, that sounds like a good topic… /me jots that down…)
slakcphil says:
Hey man, I love playing with python and have been looking for a way to write a simple script that updates a system via apt, as well as compressing and copying log files. I can do this at a BASH prompt manually, but would enjoy seeing how it could be done with a scripting lang like python.
cryptk says:
That is a good request, but there are tools already in place to do much of that. So perhaps a post about how to properly use those tools rather than how to script it from the start… Remember the post, it is always best to do things the way it was intended, because that is how others will expect it to be done.
cryptk says:
Just made a post covering automatic upgrades on Ubuntu, here's a link http://www.cryptkcoding.com/2011/04/enabling-auto…