How to Be a Good (lazy) System Administrator

Source: Internet
Author: User
Tags disk usage
Article Title: how to be a good (lazy) system administrator. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

If you are a common system administrator, you feel insufficient personnel, insufficient funds, and excessive work. Now, you are used to this idea: No one will realize that you exist until the email server is paralyzed, and then you suddenly become the most needed person in the United States. In this article, I assume that you are responsible for managing many servers. I also assume that you do not really want to work as hard as possible. If you do, you should become a Windows server administrator and start to worry about patches, security vulnerabilities, and virus protection from Microsoft, A clumsy user interface is inherently missing scripts. I am not saying that Linux is perfect, but there are many things that make Linux easier to manage.

As a good system administrator, you want to do your job well, but you do not want to work hard as a lazy system administrator. In this article, I will share some simple things you can do to make your work easier.

Over the years, I have developed a kind of mantro. "If I have to do something more than once, I will write my scripts to complete it ." For example, if I need to check the health status of my server every morning, I will write a script to collect information, format it, and mail the results to myself. If I need to make configuration changes on 12 machines, I will have some scripts to do it. At the beginning, you may think that it is as simple as writing and debugging a script to complete the work manually. But there are some advantages hidden in my working methods. Once the script works well, the characters will become repeatable and can be delegated to a lower-level technician or automatically completed. Basically, you don't need to do everything; it will do everything on its own. We will talk more about scripts soon.

To facilitate script tasks and manage multiple servers, I need to configure authentication-based authentication on each server. It takes only a few minutes on every server and it can make your life easier. Because you no longer need to enter the password, file transmission, support and maintenance tasks can be completed through scripts. Because there are a lot of simple commands on the Internet about how to configure authentication-based authentication, here I will not waste time talking about these things.

Once we make the identification work normally, let's begin to make our Russian life easier. What I like to do is create a shell script to export useful variables, such

# Servers. sh
Export MAILSERVERS = "server1 server2 server3"
Export WEBSERVERS = "www1 www2 www3 www4"
Then I can run a simple script like this:
#! /Bin/bash
### Assess disk space on mail servers
Source./servers. sh
For I in $ {MAILSERVERS}; do
Echo ===========$ {I }==================
Ssh root @ $ {I} "df"
Echo ======================================
Done

This simple script allows me to quickly get the disk usage of all my mail servers. It can also be used as a template for other similar tasks. When I want to complete another task using a script, I will copy this script and replace some content at the top to describe the purpose of the new script and replace the body of the for loop.
Note that all my scripts are from the servers. sh file, so I have a central point for configuration. When I add or delete a server, I will simply change the file.

Pay attention to the content at the top of the file. Once you have about 50 different scripts in a single directory, you can name them like this
Assess_the_disk_space_on_mail_servers.sh, and I refuse to do so. So when I need to point out what the script is doing, I will:
Grep "###" *

This gives me a list of scripts and a simple description of their tasks.

[1] [2] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.