Mastering Python Scripting for System Administrators
Write scripts and automate them for real-world administration tasks using Python
Ganesh Sanjiv Naik
BIRMINGHAM - MUMBAI
Mastering Python Scripting for System Administrators
Copyright 2019 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Vijin Boricha
Acquisition Editor: Shrilekha Inani
Content Development Editor: Sharon Raj
Technical Editor: Prashant Chaudhari
Copy Editor: Safis Editing
Project Coordinator: Drashti Panchal
Proofreader: Safis Editing
Indexer: Rekha Nair
Graphics: Tom Scaria
Production Coordinator: Jyoti Chauhan
First published: January 2019
Production reference: 1240119
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78913-322-6
www.packtpub.com
I wish to dedicate this book to my Gurudev, His Holiness Dr. Jayant Balaji Athavale. I wish to express gratitude for his guidance on how to become a good human being, a good professional, and a seeker on the path of spiritual progress.
mapt.io
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Packt.com
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.
At www.packt.com , you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Contributors
About the author
Ganesh Sanjiv Naik is an author, consultant, and corporate trainer in the fields of AI, data science, machine learning, the Internet of Things (IoT), and embedded Linux in relation to product development. He has more than 20 years of professional experience in information technology. Ganesh has a passion and a deep desire for teaching. He has trained 2,000+ engineers in Linux and Android product development. He has worked as a corporate trainer for the ISRO, Intel, GE, Samsung, Motorola, Penang Skill Development Center (Malaysia), and various companies in Singapore, Malaysia, and India. He has started a company called Levana Technologies, which works in AI, machine learning, and data science, providing training, projects, and consultancy activities.
I want to thank my wife, Vishalakshi Naik, for providing valuable suggestions, support, and continuous motivation. I also want to thank my colleagues, Mansi Joshi and Kalpesh Patil, who helped me in editing and proofreading, and also provided feedback from a technical perspective.
Big thanks to the entire team at Packt, especially Shrilekha Inani, Priyanka Deshpande, and Sharon Raj, for providing me with motivating support throughout the book.
About the reviewers
Yogendra Sharma is a developer with experience in the architecture, design, and development of scalable and distributed applications, with a core interest in microservices and Spring. He is currently working as an IoT and cloud architect at Intelizign Engineering Services Pvt, Pune. He also has hands-on experience in technologies such as AWS Cloud, IoT, Python, J2SE, J2EE, Node.js, Angular, MongoDB, and Docker. He constantly explores technical novelties, and he is open-minded and eager to learn about new technologies and frameworks. He has reviewed several books and video courses published by Packt Publishing.
Abhijeet Mote has a master's degree in computer application (MCA) from University of Mumbai. He is an open source evangelist and works as a senior software engineer. He has worked in multiple domains, including education, media, and IoT. His hobbies involve work on open source projects, and he loves to give back to the open source community by spreading knowledge of Python and other open source stacks. He conducts training sessions for students, teachers, and enthusiastic developers, and he mentors students for their final year projects. He has been invited to conferences, such as FOSSASIA 2018, and PyGotham, for his contribution in teaching open source technology to enthusiastic developers and underrepresented groups.
Packt is searching for authors like you
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Preface
Python has evolved and extended its features toward every possible IT operation. This book will help you leverage the latest features of Python to write effective scripts and create command-line tools (for use when it comes to data types, loops, conditionals, functions, error handling, and more) to administer your environment. This book will revolve around the entire development process, from setup and planning to automated testing and building different command-line tools. This book gets you up and running with everything from basic scripting to using standard library packages. Finally, you will create a large scripting project where you will learn how to plan, implement, and distribute a project based on ideal resources.
Next page