#!/usr/bin# Setting up a database connection conn='Mysql-hhost-pport-uusername-ppassword'#获取最新的binlog文件logfile=$ ($conn-E"Show Master Logs"|Tail-N1|awk-F" " '{print $}') #设置a为1, the user's bottom of the judgment a=1#while循环 while true
As a database DBA for Linux systems operations or Linux, there are many times when you need to write scripts to help us achieve some of the requirements, and if some content within the script can try parallel processing, it will greatly improve the
Linux CentOS under the shell display-bash-4.1$ does not display the user name path resolution problem Description: A new user is added under CentOS, and the shell script information is as follows: Instead of what we often see [email Protected] is a
1. What is a shell?The shell is the user interface of the system and provides an interface for users to interoperate with the kernel. It receives the command entered by the user and feeds it into the kernel to execute.In fact, the shell is a command
I. Special documents : /dev/null and/dev/ttyThe Linux system provides two special files that are very useful for Shell programming,/dev/null and/dev/tty. Where/dev/null will lose all the data written to it, in other words, when the program writes
The scenario where the problem occurs is probably 1 cron calls a Python script 2. In the Python script, call a shell script (for log analysis) to obtain the shell output and then send an email. Similar to a monitoring task. There is no
Suppose we define a variable:File =/dir1/dir2/dir3/my.file.txt
You can replace $ {} with different values:$ {File # */}: Delete the first/and its left string: dir1/dir2/dir3/my.file.txt$ {File ### */}: Delete the last/and its left string:
1. Change the password
Use the passwd command to change the password.
If the command is executed under the root user, the password of the root user is modified.2. Get help
Use the LS -- Help Command to obtain help.
1 [[email protected] ~] $ Ls --
Primary
Meaning
[- File]
True ifFileExists.
[-B File]
True ifFileExists and is a block-special file.
[-C File]
True ifFileExists and is a character-special file.
[-D File]
True ifFileExists and
Getting started with shell script
Note:
1. execute commands from top to bottom and from left to right;2. execute commands as mentioned in Chapter 5: multiple blank spaces between commands and options are ignored;3. blank lines will also be
If judgment
I have also written a simple shell script before, and it is not transferred to O & M. It has less work related to the system, so it is not very skilled.
Recently, as the system has encountered various messy problems and no one has helped
While test conditions
Do
Statement 1
Statement 2
Done
Test condition: if the condition is met, the loop is closed until the condition is not met.
How does a while loop exit? Change the variable value corresponding to the test condition in the loop
In Linux, how does one use shell scripts to capture remote logs? There is a dilemma in analyzing online logs. There are too many machines. It is unrealistic to log on to each server, but it is more troublesome to download the logs because each SCP
If you use Linux as your work environment, this article is a good news! Because I often use SSH to log on to other hosts during my study/work (especially recently Playing Raspberry Pi), and every time I use SSH to log on, I need to enter a long
Tag: style blog HTTP color file 2014
Recently, when learning about Jenkins, there is a problem: the number of subdirectories under the Linux ext3 system directory cannot exceed 31998 (refer to: http://www.xshell.net/linux/1267.html), but Jenkins
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