Database backup shell Script

Law One:#!/bin/bash[!-d/server/backup] && mkdir/server/backupmysqldump-u root-a-B >/server/backup/a.sql[!-f/ Server/backup/a.sql] && mail-s "bak faile" Law II: #!/bin/shdate=$ (date +%y-%d-%m) des=/usr/src/mysql_bakmysql_u= " Root "mysql_p=" 123456 "

Shell file permissions and script execution

I. Rights Management1. View file propertiesLs-l2. Permission TypeIi. Linux Users and permissions1. User Management① Viewing usersID User1② adding usersUseradd user1③ Deleting a userUserdel-r user11. User Group① New GroupGroupadd G1② Deleting a

Shell Analysis Nginx Log

The following scripts are based on the above log format, and if your log format is different, you need to adjust the parameters behind awk. in the analysis log UserAgentCat Access_20130704.log | Awk-f "\" "' {print $ (NF-3)} ' | Sort | uniq-c | Sort-

Shell Getting Started exercise

* * Define local variables, local variables will expire when exiting the shell client * ** * Single quote: Output AS-is * ** * Double quotes: If there are variables, the variables will be output * ** * No quotation marks: Output variable * *You can

How to write a shell script

1. First create a directoryVI hello.sh2. Write the first line of the shell#!/bin/bash (in order to declare a shell script, the first line must be written like this)3. You can add comments #the First program (this line of add # is not in effect)4.

Shell exercises-processing logs

Write a script to find the/data/log directory, the last created time is 3 days ago, the suffix is *.log file, packaged and sent to 192.168.1.2 Service under/data/log, and delete the original. log file, leaving only the packaged

Easy to use shell small programming

1 "Judge input as number, character or otherScript code:Test results:2 "Averaging:Test results:3 "self-reducing output:Script code:      Test results:4. Add a prefix to the file:Script code:Effect Display:5 "Batch test file is present:Script

Linux is called shell script to delete files

Writing ScriptsVI delbak.shThe code is as follows :#!/bin/shlocation= "/home/mysql/backup/"Find $location-mtime +7-type f |xargs rm-fexplanation :Location is the directory where the lookup is set--mtime +7 is set to 7 days ago (delete files from

Shell Exercises-judging functions

Use the conditional function if to compose a shell function called F_judge, which implements the following functions1) when the/home/log directory exists, move the files or directories that start with all TMP in the/home directory to the/home/log

Pipe and job control, shell variables, environment variable profiles

Pipe character and job control; indicates that the previous command executes the next command in sequence[email protected] ~]# cat 1.txt |wc-l; Cat 1.txt |grep ' aaa '2AAAAAAAAAAAaqweaaaaaaaaa&&: The previous command is correct to execute the

Shell Execution Order

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/7E/AC/wKiom1cGe1ui4oqIAABm6P93Pb8114.jpg "height=" 142 " Width= "192" alt= "Wkiom1cge1ui4oqiaabm6p93pb8114.jpg"/> Shell script to today, I can only kept

Common shortcut key collection under Linux terminal shell

Delete"Ctrl" + "D" removes the character at the cursor location equivalent to VIM x or DL"Ctrl" + "H" removes the character in front of the cursor, which corresponds to the HX or DH in vim."Ctrl" + "K" removes all characters after the cursor

Shell Programming (v)

Learning from the previous articles, we learned the basic syntax of the shell. In the actual operation of Linux, we often see the command will have many parameters, such as: Ls-al, and so on, then how this parameter is handled? Let's take a look at

5th day (half day) "Shell programming preliminary, grep and regular Expressions"

Day 5th (half day) "Shell programming preliminary, grep and regular expression" shell programming preliminary (_RECV)Shell script: Text file#!:/ Bin/bash#!:/ Usr/bin/python#!:/ Usr/bin/perlCase Listing 1:Vim first.sh#!:/

Shell Common Scripts

Shell Common ScriptsAuthor:headsen Chen 2017-10-17 15:36:17Personal original, reproduced please indicate, otherwise, legal liability shall be investigated1,vim name.grep.sh2,cat tellme.sh3,cat idcheck.sh4,cat case.shNote: The file name is called in

Shell's looping nesting syntax

To test the shell's looping nesting syntax1[Email protected] test]#VIXunhuanqiantao.SH 2#!/bin/Bash3 #程序功能描述:4 # test Loop nesting5 #作者: Lone boat Point6#版本:1.07#创建时间: .-Ten- A Geneva: $:

Shell finishing (31) = = = To determine if the input is IP

(title): Determine if the incoming parameter is IPIdea: 192.168.1.1is the condition of the IP, * * * dot decimal This four number must be less than 255Dot decimal must be guaranteed to be a number, not a letter#!/bin/bash[ -z $1 ] && echo  "uesage : 

Common shell commands

1. Find the contents of the file (e.g. account number: zh123456): Grep;lsMode 1 Find all Files: grep zh123456 *Mode 2 recursive lookup: ls | Xargs grep zh123456Mode 3 Recursive lookup: Find. -name ' apf44_zswmpay* ' |xargs grep applog|awk-f ": '

[Shell programming] automatically deletes operating system users

Linux often need to delete user actions, manual operation to perform Userdel operation can, if the deletion fails according to the error prompt action. But what if the script needs to invoke the Delete user action? Use the following example to

Shell programming Syntax (i)

Steps to create a shell program:First step: Create a script file. Sh.Second step: Grant permissions so that it can execute chmod u+x. shStep three: Execute./example or SH exampleShell structure:1. #! Specifies the shell that executes the script2.

Total Pages: 541 1 .... 443 444 445 446 447 .... 541 Go to: GO

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.