Perl Automatizacion
Automating System Administration with Perl
Download at Boykma.Com
SECOND EDITION
Automating System Administration with Perl
David N. Blank-Edelman
Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo
Download at Boykma.Com
Download at Boykma.Com
Automating System Administration with Perl, Second Edition
by David N. Blank-EdelmanCopyright © 2009 O’Reilly Media, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact ourcorporate/institutional sales department: 800-998-9938 or corporate@oreilly.com.
Editor: Andy Oram Production Editor: Sarah Schneider Copyeditor: Rachel Head Proofreader: Kiel Van Horn Printing History:
May 2009: Second Edition.
Indexer: Lucie Haskins Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano
O’Reilly and the O’Reilly logo are registeredtrademarks of O’Reilly Media, Inc. Automating System Administration with Perl, the image of a sea otter, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designationshave been printed in caps or initial caps.
While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein.
ISBN: 978-0-596-00639-6 [M] 1241809111
Download at Boykma.Com
To Cindy, ever the love of my life, and to Elijah, a trueblessing.
Download at Boykma.Com
Download at Boykma.Com
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Automation Is a Must How Perl CanHelp You This Book Will Show You How What You Need Some Notes About the Perl Versions Used for This Book What About Perl 5.10? What About Strawberry Perl? What About Perl 6? Some Notes About Using Vista with the Code in This Book Locating and Installing Modules Installing Modules on Unix Installing Modules on Win32 It’s Not Easy Being Omnipotent Don’t Do It Drop Your Privileges As Soon As PossibleBe Careful When Reading Data Be Careful When Writing Data Avoid Race Conditions Enjoy References for More Information 1 2 3 5 6 6 6 6 7 8 9 9 10 10 10 11 12 12 13 13
2. Filesystems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Perl to the Rescue Filesystem Differences Unix Windows-Based Operating Systems Mac OS XFilesystem Differences Summary Dealing with Filesystem Differences from Perl 15 16 16 16 18 19 19
vii
Download at Boykma.Com
Walking or Traversing the Filesystem by Hand Walking the Filesystem Using the File::Find Module Walking the Filesystem Using the File::Find::Rule Module Manipulating Disk Quotas Editing Quotas with edquota Trickery Editing Quotas Using the Quota Module Editing NTFS QuotasUnder Windows Querying Filesystem Usage Module Information for This Chapter References for More Information
21 26 36 38 40 44 45 46 48 48
3. User Accounts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Unix User Identities The Classic Unix Password File Changes to the Password File in BSD 4.4 Systems Shadow Passwords...
Regístrate para leer el documento completo.