13.07.2015 Views

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

Linux System Administration Recipes A Problem-Solution Approach

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

C H A P T E R 1■ ■ ■Saving Yourself EffortThis chapter covers the essential attribute of a sysadmin: laziness. The more time and effort you saveoverall, the more time you have to do other things: whether that’s fixing other problems, setting up moresystems, or surfing the Internet while you wait for the next thing to break. Documentation, goodscripting practice, and version control are all ways of saving yourself time (sometimes quite a lot of time)in the long run, so they are worth investing time in up front.1-1. Documentation: Knowing It’s a Good ThingThe problem with documentation (specifically, with motivating yourself to actually do it) is that it’s easyto think that of course you’ll remember exactly what you did to fix a particular problem. Immediatelyafter you’ve just spent several hours, or even several days on it, it’s all very clear in your mind and seemsincredibly memorable, even obvious. So, you don’t stop to document it but instead hurry on to the nextproblem in your queue.Unfortunately, whatever you may optimistically think, you really don’t have that good a memory(sorry!). In six months, when something else similar, or even the same thing on a different machine,crops up, you’ll be left with a vague feeling of recognition and maybe a detail or two.Even while you’re actually in the process of investigating a problem, it can be easy to lose track ofwhat you’re doing. You make lots of changes in a hurry, changing various factors in the hope of gettingmore information or finding a fix, and then you forget what you just changed, what you changed beforethat, why you changed it, and whether you tested properly between times.That’s why proper documentation, even if only for yourself, really is worth the effort both whileyou’re working and as a record afterward.1-2. Documentation: Keeping Track of What You’re DoingThe first part of the documentation problem is to keep track of what you’re doing while you’re doing it.This recipe assumes that you’re using bash and a fairly standard <strong>Linux</strong> setup.While you’re actively troubleshooting, do your best to make at least a brief note of everything youtry. A dead-tree notebook can be really helpful here. As well as helping you keep track of what you’vealready tried, the act of writing things down can sometimes generate new realizations. If you lose track ofwhere you are or what you’ve done, scrolling back through your bash history (or looking at~/.bash_history) will remind you. There are a couple of history settings that you can change to makethis easier and more informative. Try adding these lines to your ~/.bashrc:1Download at WoweBook.Com

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!