Shell scripts regularly back up the database

Script code:New File back_db.sh #!/bin/Bash Todaytime="' Date +%y%m%d '"DBNAME="test MySQL"Dumppath="/usr/local/webserver/mysql/bin/mysqldump"HOST="XXX"USER="XXX"PASSWD="XXX"Db_file="/home/data/backup/db_$todaytime.sql.gz"

Some summary of shell script usage

(1), the CSH script can call Bash's script, and vice versa.(2). How to invoke variables and functions defined in other scripts.(3). The variable defined, which defaults to a global variable. Local variables need to be specified locally to declare

Regular expressions in the Shell

Often in contact with the Shell scripting language, you will often see a shell command followed by a bunch of messy option, similar to the sed-e "s/^[^\-]*-//" , although know that it must be a logical combination of conditions, but if not familiar

2 Simple shell scripts (if,while,case statements)

Experimental requirements:1. Write a script called sum.sh, prompting the user to enter an integer less than 100, and to calculate all integers from 1 to that number2. Write a script called tar.sh, which is used to extract compressed files in. tar.gz

Two simple shell scripts (about startup and service)

Experimental requirements:1. Write a login welcome script for root user, report the number of processes in the current host, the number of logged in users, and the disk usage of the root file system.2, write three scripts: Start,stop and status,

Shell Script Note 3-looping

For List formFor variable in {list}do statementdonefor var in 1 2 3 4do echo $vardonefor var in {1..4}do echo $vardonefor v Ar in {start.. End.. Step}do statementdonefor i in {1..100..2}do echo $idonefor file in $ (LS) does echo

Learning of shell scripts in Linux (i)

The shell in Linux is a special application. It is between the kernel of the system and the user. Serves as the role of the command "interpreter". Responsible for receiving the user input operation instructions, and to explain. Pass the action that

Until practice of Shell Programming basics

First, the grammaruntil [Condition] # and while on the contrary, when the condition condition is established, the loop is terminated, or the program segment that continues the loop does #执行内容done Second, practice Enter the user input

Some basic uses of the shell

View all the available shell types under the current system: Cat/etc/shellsSet the shell type to be used for the current system:/BIN/ZSH (Take this as an example): Chsh-s/bin/zshAfter the current shell setup is complete, you need to restart your

Write your own shell command of LS

The C language implementation of the LS command under Linux (supports the-R parameter):#include #include #include #include #include #include #include void Do_ls (char *), void Do_stat (char *,char *); void Show_ File_info (char *,struct stat *,

Two shell questions (from netizens)

Question 1: [[Email protected] ~] # Cat ABC 1aabbb2ccddd3eefff4gghhh Change 1aabbb2ccddd3eefff4gghhh Implementation command: Sed '/[0-9]/n; S/\ N //;/[A-Z]/n; S/\ N //; n; D' ABC Question 2: [[Email protected] ~] # Cat ip.txt 172.16.1.10

Shell BASICS (8)-cyclic statements

   国庆过后;感觉有点慵懒些了;接着上篇;我们继续来学习循环语句。     一. for循环         与其他编程语言类似,Shell支持for循环。 for循环一般格式为:for 变量 in 列表do command1 command2 ... commandNdone    列表是一组值(数字、字符串等)组成的序列,每个值通过空格分隔。每循环一次,就将列表中的下一个值赋给变量    例如,顺序输出当前列表中的数字 for01.sh$ cat for01.sh

HDU 2446 shell pyramid (Binary Search mathematics)

Question link: http://acm.hdu.edu.cn/showproblem.php? PID = 1, 2446 Problem descriptionin the 17th century, with Thunderous Noise, dense smoke and blazing fire, battles on the sea were just the same as those in the modern times. but at that time,

Shell script to start the program

We all know that the JVM itself provides a lot of commands for users to call. Sometimes we need to use these commands to write some scripts to execute our program. First, let's talk about the directory structure of the following script: Bin script

Tips for getting parameters from shell scripts

The problem is as follows: perform a loop based on the number of Script Parameters $ #, and output each parameter $1 $2 $3 in sequence ...... I have a loop variable I $ I. When I get this variable I is 1, I want to use this 1 and then call $1, that

Rotate the Shell Part Template

mul

Convex hull diameter Detailed description of convex hull diameter // Calculate the convex hull diameter. Input convex hull Ch. The number of vertices is N, which is arranged counterclockwise. The square of the output diameter Int rotating_calipers

[Practice] is a disaster caused by carriage return -- shell scripts must end with a Unix line

Start:The URL of svnis in excel. I copied it to txt.pdf, while VIOs only extracted the URL and saved it as url.txt.You can use VI to process url.txt, add SVN checkout, and other words to become the svn. Sh that can be run. Each row isSVN checkout.../

BASH Shell for loops 1 to 100.

Preface when using bash shell to write a program, the for loop is often used, especially the requirement from 1 to 100. Here we record the C language of several types of loop methods from 1 to 100 in shell. [HTML]View plaincopyprint? For (I = 1; I

Summary of the use of shell scripts and the use of shell scripts

Summary of the use of shell scripts and the use of shell scripts (1) The csh script can call the bash script, and vice versa. (2). How to call variables and functions defined in other scripts. (3). Defined variables. The default value is global

[Shell] The relative path cannot be found when crontab executes the task and calls the shell script.

[Shell] The relative path cannot be found when crontab executes the task and calls the shell script. 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

Total Pages: 541 1 .... 507 508 509 510 511 .... 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.