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:
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.
Tasks can be performed according to whatever schedule seems appropriate and need not depend on your availability or even your presence.
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
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 ...