Python for Unix and Linux System Administration
Publisher: O'Reilly Media
Release Date: June 2009
Pages: 458
Read on Safari with a 10-day trial
Start your free trial now Buy on AmazonWhere’s the cart? Now you can get everything on Safari. To purchase books, visit Amazon or your favorite retailer. Questions? See our FAQ or contact customer service:
1-800-889-8969 / 707-827-7019
support@oreilly.com
Each chapter in Python for Unix and Linux System Administration presents a particular administrative issue, such as concurrency or data backup, and presents Python solutions through hands-on examples. Once you finish this book, you'll be able to develop your own set of command-line utilities with Python to tackle a wide range of problems. Discover how this language can help you:
- Read text files and extract information
- Run tasks concurrently using the threading and forking options
- Get information from one process to another using network facilities
- Create clickable GUIs to handle large and complex utilities
- Monitor large clusters of machines by interacting with SNMP programmatically
- Master the IPython Interactive Python shell to replace or augment Bash, Korn, or Z-Shell
- Integrate Cloud Computing into your infrastructure, and learn to write a Google App Engine Application
- Solve unique data backup challenges with customized scripts
- Interact with MySQL, SQLite, Oracle, Postgres, Django ORM, and SQLAlchemy
With this book, you'll learn how to package and deploy your Python applications and libraries, and write code that runs equally well on multiple Unix platforms. You'll also learn about several Python-related technologies that will make your life much easier.
Table of Contents
-
Chapter 1 Introduction
-
Why Python?
-
Motivation
-
The Basics
-
Executing Statements in Python
-
Using Functions in Python
-
Reusing Code with the Import Statement
-
-
Chapter 2 IPython
-
Installing IPython
-
Basic Concepts
-
Help with Magic Functions
-
Unix Shell
-
Information Gathering
-
Automation and Shortcuts
-
Summary
-
-
Chapter 3 Text
-
Python Built-ins and Modules
-
Log Parsing
-
ElementTree
-
Summary
-
-
Chapter 4 Documentation and Reporting
-
Automated Information Gathering
-
Manual Information Gathering
-
Information Formatting
-
Information Distribution
-
Summary
-
-
Chapter 5 Networking
-
Network Clients
-
Remote Procedure Call Facilities
-
SSH
-
Twisted
-
Scapy
-
Creating Scripts with Scapy
-
-
Chapter 6 Data
-
Introduction
-
Using the OS Module to Interact with Data
-
Copying, Moving, Renaming, and Deleting Data
-
Working with Paths, Directories, and Files
-
Comparing Data
-
Merging Data
-
Pattern Matching Files and Directories
-
Wrapping Up rsync
-
Metadata: Data About Data
-
Archiving, Compressing, Imaging, and Restoring
-
Using tarfile Module to Create TAR Archives
-
Using a tarfile Module to Examine the Contents of TAR Files
-
-
Chapter 7 SNMP
-
Introduction
-
Brief Introduction to SNMP
-
IPython and Net-SNMP
-
Discovering a Data Center
-
Retrieving Multiple-Values with Net-SNMP
-
Creating Hybrid SNMP Tools
-
Extending Net-SNMP
-
SNMP Device Control
-
Enterprise SNMP Integration with Zenoss
-
-
Chapter 8 OS Soup
-
Introduction
-
Cross-Platform Unix Programming in Python
-
PyInotify
-
OS X
-
Red Hat Linux Systems Administration
-
Ubuntu Administration
-
Solaris Systems Administration
-
Virtualization
-
Cloud Computing
-
Using Zenoss to Manage Windows Servers from Linux
-
-
Chapter 9 Package Management
-
Introduction
-
Setuptools and Python Eggs
-
Using easy_install
-
easy_install Advanced Features
-
Creating Eggs
-
Entry Points and Console Scripts
-
Registering a Package with the Python Package Index
-
Distutils
-
Buildout
-
Using Buildout
-
Developing with Buildout
-
virtualenv
-
EPM Package Manager
-
-
Chapter 10 Processes and Concurrency
-
Introduction
-
Subprocess
-
Using Supervisor to Manage Processes
-
Using Screen to Manage Processes
-
Threads in Python
-
Processes
-
Processing Module
-
Scheduling Python Processes
-
daemonizer
-
Summary
-
-
Chapter 11 Building GUIs
-
GUI Building Theory
-
Building a Simple PyGTK App
-
Building an Apache Log Viewer Using PyGTK
-
Building an Apache Log Viewer Using Curses
-
Web Applications
-
Django
-
Conclusion
-
-
Chapter 12 Data Persistence
-
Simple Serialization
-
Relational Serialization
-
Summary
-
-
Chapter 13 Command Line
-
Introduction
-
Basic Standard Input Usage
-
Introduction to Optparse
-
Simple Optparse Usage Patterns
-
Unix Mashups: Integrating Shell Commands into Python Command-Line Tools
-
Integrating Configuration Files
-
Summary
-
-
Chapter 14 Pragmatic Examples
-
Managing DNS with Python
-
Using LDAP with OpenLDAP, Active Directory, and More with Python
-
Apache Log Reporting
-
FTP Mirror
-
-
Appendix Callbacks
-
Colophon