Chapter 14. Automating Administrative Tasks
Although extensive programming experience is seldom a requirement for
a system administration position, writing shell scripts and other
sorts of programs is nevertheless an important part of a system
administrator's job. There are two main types of
programs and scripts that you will be called upon to create:
Those designed to make system administration easier or more
efficient, often by automating some process or job.
Those that provide users with necessary or helpful tools that are not
otherwise available to them.
This chapter discusses scripts intended for both contexts.
In general, automation offers many advantages over performing such
tasks by hand, including the following:
- Greater reliability
-
Tasks are performed in the same (correct)
way every time. Once you have automated a task, its correct and
complete performance no longer depends on how alert you are or your
memory.
- Guaranteed regularity
-
Tasks can be performed according to whatever schedule seems
appropriate and need not depend on your availability or even your
presence.
- Enhanced system efficiency
-
Time-consuming or resource-intensive tasks can be performed during
off hours, freeing the system for users during their normal work
hours.
We've already considered the cron
facility, which runs commands and scripts according to a preset
schedule (see Section 3.2). In this chapter,
we'll begin by looking at some example shell scripts
and then consider some additional programming/scripting languages and
other automation tools.
|
Lazy people write shell scripts.Laziness is a very
important system administrative virtue when it motivates you to
create new tools and utilities that make your job easier, more
efficient, or even just more pleasant. Ploddingly industrious people
type the same commands over and over, day after day; lethargic people
write scripts to make the job go faster; truly lazy people develop
utilities and programs that make all kinds of jobs go faster
(including ones they weren't even thinking about
when they started).
Writing shell scripts, Perl scripts, Expect scripts, or C programs
will also force you to develop another of the seven system
administrative virtues:patience
(you'll need it to see a sometimes frustrating task
through to its conclusion).
|
|