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.
Preface; How This Book Is Structured; Typographical Conventions; How to Contact Us; Acknowledgments; Chapter 1: Introduction; 1.1 System Administration Is a Craft; 1.2 How Perl Can Help; 1.3 This Book Will Show You How; 1.4 What You Need; 1.5 Locating and Installing Modules; 1.6 It’s Not Easy Being Omnipotent; 1.7 References for More Information; Chapter 2: Filesystems; 2.1 Perl to the Rescue; 2.2 Filesystem Differences; 2.3 Walking or Traversing the Filesystem; 2.4 Walking the Filesystem Using the File::Find Module; 2.5 Manipulating Disk Quotas; 2.6 Querying Filesystem Usage; 2.7 Module Information for This Chapter; 2.8 References for More Information; Chapter 3: User Accounts; 3.1 Unix User Identity; 3.2 Windows NT/2000 User Identity; 3.3 Building an Account System to Manage Users; 3.4 Module Information for This Chapter; 3.5 References for More Information; Chapter 4: User Activity; 4.1 MacOS Process Control; 4.2 NT/2000 Process Control; 4.3 Unix Process Control; 4.4 Tracking File and Network Operations; 4.5 Module Information for This Chapter; 4.6 References for More Information; Chapter 5: TCP/IP Name Services; 5.1 Host Files; 5.2 NIS, NIS+, and WINS; 5.3 Domain Name Service (DNS); 5.4 Module Information for This Chapter; 5.5 References for More Information; Chapter 6: Directory Services; 6.1 What’s a Directory?; 6.2 Finger: A Simple Directory Service; 6.3 The WHOIS Directory Service; 6.4 LDAP: A Sophisticated Directory Service; 6.5 ADSI (Active Directory Service Interfaces); 6.6 Module Information for This Chapter; 6.7 References for More Information; Chapter 7: SQL Database Administration; 7.1 Interacting with an SQL Server from Perl; 7.2 Using the DBI Framework; 7.3 Using the ODBC Framework; 7.4 Server Documentation; 7.5 Database Logins; 7.6 Monitoring Server Health; 7.7 Module Information for This Chapter; 7.8 References for More Information; Chapter 8: Electronic Mail; 8.1 Sending Mail; 8.2 Common Mistakes in Sending Email; 8.3 Receiving Mail; 8.4 Module Information for This Chapter; 8.5 References for More Information; Chapter 9: Log Files; 9.1 Text Logs; 9.2 Binary Log Files; 9.3 Stateful and Stateless Data; 9.4 Disk Space Problems; 9.5 Log Analysis; 9.6 Module Information for This Chapter; 9.7 References for More Information; Chapter 10: Security and Network Monitoring; 10.1 Noticing Unexpected or Unauthorized Changes; 10.2 Noticing Suspicious Activities; 10.3 SNMP; 10.4 Danger on the Wire; 10.5 Preventing Suspicious Activities; 10.6 Module Information for This Chapter; 10.7 References for More Information; The Five-Minute RCS Tutorial; References for More Information; The Ten-Minute LDAP Tutorial; LDAP Data Organization; The Eight-Minute XML Tutorial; XML Is a Markup Language; XML Is Picky; Two Key XML Terms; Leftovers; The Fifteen-Minute SQL Tutorial; Creating /Deleting Databases and Tables; Inserting Data into a Table; Querying Information; Changing Table Information; Relating Tables to Each Other; SQL Stragglers; The Twenty-Minute SNMP Tutorial; SNMP in Practice; Colophon;