Some people plan to become administrators. The rest of us are thrust into it: we are webmasters, hobbyists, or just the default "technical people" on staff who are expected to keep things running. After some stumbling around repeating the same steps over and over again (and occasionally paying the price when we forget one), we realize that we must automate these tasks, or suffer endless frustration. Thus enters Perl.The Perl programming language is ideal for writing quick yet powerful scripts that automate many administrative tasks. It's modular, it's powerful, and it's perfect for managing systems and services on many platforms.Perl for System Administration is designed for all levels of administrators--from hobbyists to card-carrying SAGE members--sysadmins on multi-platform sites. Written for several different platforms (Unix, Windows NT, and Mac OS), it's a guide to the pockets of administration where Perl can be most useful for sites large and small, including:
- Filesystem management
- User administration with a dash of XML
- DNS and other network name services
- Database administration using DBI and ODBC
- Directory services and frameworks like LDAP and ADSI
- Using email for system administration
- Working with log files of all kinds
Each chapter concentrates on a single administrative area, discusses the possible pitfalls, and then shows how Perl comes to the rescue. Along the way we encounter interesting Perl features and tricks, with many extended examples and complete programs. The scripts included in the book can simply be used as written or with minimal adaptation. But it's likely that readers will also get a taste of what Perl can do, and start extending those scripts for tasks that we haven't dreamed of.
Perl for System Adminstration doesn't attempt to teach the Perl language, but it is an excellent introduction to the power and flexibility of Perl, and it whets the appetite to learn more. It's for anyone who needs to use Perl for system administration and needs to hit the ground running.
Perl's cross-platform compatibility is less of an advantage to sysadmins than you might think. Most useful Perl programs need to access files and file access conventions are quite different across Unix/Windows/Mac platforms. The author deals with such issues early along with the oddities of installing Perl on different platforms and the need for sysadmins to write clean, robust and secure programs. Recent Net exploits underline the last point.
The content is, though, far from theoretical. One of the first script examples shows how to recursively walk a file tree using Perl alone and then an even better way using Perl's File:Find module. Having created a filewalking script, Blank-Edelman then explains the various platform gotchas you need to consider when filewalking on different platforms because of differences in the way each file system works.
This relentless attention to the underpinnings of different operating systems is the real strength of Blank-Edelman's book. He writes as someone who not only does this stuff every day but likes getting his hands dirty, and--unlike the famous fictional sysadmin, BOFH--enjoys explaining how it all works.
His approach is especially valuable when dealing with the complexities of database management, e-mail and security. For example, in the latter section, to locate a misbehaving user, the author uses Perl to interrogate a Cisco Catalyst 5500 switch though the story following - a strange but amusing partial routing failure - hammers home Perl's flexibility and development speed.
Blank-Edelman assumes you already know Perl, but once you've read Perl for System Administrators you'll know enough about the glistening innards of network OSs to use it reliably and securely for network admininstration. It helps that it's also a great read. --Steve Patient