Shell script automatically backs up the database

#!/bin/bashdb_user= "root" db_passwd= "dddddd" db_name= "Mmmmmm" Cd/db_backupecho "You is in Bakmysql directory Now" Backup_dir= "/db_backup" #时间格式time =$ (date+ "%y+%m+%d") #mysql备份命令mysqldump-u$db_user-p$db_passwd $db _name > "$ backup_dir/$db

Daily Shell Exercises (04)

1. ExercisesDesign a script that monitors the surviving state of a remote host (assuming the IP address is 110.110.110.114) and sends a message to yourself when it finds an outage.Tips: You can use the ping command: ping -c 10 110.11

Linux shell scripts How to create a user with several looping statements

Hello everyone, I am the lone cloud twilight rain, brought to you today is the "Linux shell script several circular statements to create the user's method"Add USER1~USER20 UserFor loop:#!/bin/bashfor i in {1..20}douseradd User$iecho ' user$i Users

Daily shell scripting Exercises (01)

0. IntroductionPrepare to open a new pit and update a shell practice every day. Because shell scripts belong to the kind of skills that are unfamiliar or even forgotten when you're not practicing, I can only keep on practicing in order to resist the

Shell Regular Expression

Shell Common Regular ExpressionsCommon Regular expression ^ # line Header locates $ # end of row. # match any character except line break * # match 0 or more repeating characters + # Repeat once or more? # repeat 0

MUTT+MSMTP implementing e-mail in a shell environment

In order to automate the receipt of file backup information from the server, the MUTT+MSMTP is used to send e-mail in the shell environment, which is an easy and efficient way to complete operations.Download MSMTPwget

Shell Entry Notes (i)

Shell IntroductionDuring the development process, the Linux system is frequently contacted and used, and the shell is a bridge for our users to use Linux, and is a program written in the C language. The shell is a command language, as well as a

The logical operators for Shell script programming

1. Logical operators;Logical operator Instances:A=Tenb= -if[$a! =$b]then Echo"$a! = $b: A! = b"ElseEcho"$a! = $b: a = b"fiif[$a-lt --A $b-GT the]then Echo"$a less than 100 and $b greater than 15: Returns True"ElseEcho"$a less than 100 and $b greater

The "shell" Linux shell determines whether the variable entered by the user is a number

This article: Determine whether the user input parameter is a numberHow is the calculation done in the shell? Way One [[email protected] scripts]# echo $((1+2)) 3 Way Two Note: When using the method two, the requirements

Special variables for Linux shell programming

$ A This is the path to the script file itself (relative path)If there is an execution script file under the current directory, you cannot write an absolute path for execution.$# this variable to record the number of input parameters6 is the number

Basic operators for Shell script programming

1. Arithmetic operator: Native bash does not support simple math operations, but can be implemented with other commands, such as awk and expr,expr most commonly usedExpr is an expression evaluation tool that uses it to perform the evaluation of an

The Advanced shell script

I. Condition selection, judgment (if, case)1.1 If statement usage and examplesWhen we encounter the need to judge in the script, we can use the IF statement to implement. The specific syntax is as follows:Single Branchif judgment condition;

Shell scripts to install the NTP Server service

############################# #Deploy NTP server ########################Echo "start deploy NTP server" Yum Install-y NTPif[!-f/var/log/ntpd.log]; Then Touch/var/log/Ntpd.logfi Chownntp:ntp/var/log/Ntpd.logCat$basepath/package/ntp.conf

Introduction to "shell" Linux shell functions

Linux Shell functions Write in front: function, this word in just the beginning of the classmate looks very tall, in fact, the shell inside the function is very simple, function is actually to reduce the amount of code, so this space may be

Have finished the shell, write a little script to show you

In Linux has been learning for one months, today to write a small script, wrote three different, although simple, but you can see, I wrote the script is ping3 times to see if the host is alive!The first one is ~ ~ for~~ loop because I knocked it

Shell Script Instance

#!/bin/Bashsrc_path=/mnt/source/xx/xx# Merge All specfile forQuick Searchmergedspec="./allspec-"$(Date+%y%m%d). txtfunctionmerge_all_specs () {Allspec=$(Find$SRC _path-name *. Spec) forSpecfileinch$allSpec DoSpecname=$(basename$specFile) Specprefix=

Shell exercises (13)

Exercise 1:Formatted outputRequirements: Enter a string of random numbers and then output by thousand. for example, the input number string is "123456789", the output is 123,456,789#/bin/bash# date:2018 March 15 read-p "Please input a long number:"

Linux timed release cache shell scripts for automated operations

Users of the Linux server should know that when Linux is in use, the available memory will slowly become smaller over time, and it may eventually reach 80%-90%, which requires us to intervene manually to release the Soul village.This article will

Use of shell special variables

$ Current PIN name$# the number of arguments passed to the scriptThe first parameter, and so on$*,[email protected] All parameters$$ Current Shell Process IDShell output shell name, PID, number of parametersList parameters in sequence#!/bin/bashecho"

Linux Learning Notes (25) Shell special symbols, Sort_wc_uniq, tee_tr_split

one, special characters 1.Any character of ' * '‘? ' Any one character' # ' comment characters' \ ' de-semantic characters' | ' Pipe characterMost of them have been used before, for the caret ' \ 'Examples of the use of the caret2. Several

Total Pages: 541 1 .... 511 512 513 514 515 .... 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.