#!/bin/bash
Smail () {
smtp= "mail.mailadd.com 25" # Mail server address +25 port
smtp_domain= "mailadd.com" # Send the domain name of the mail,
from= "xxx@mailadd.com" after @ @ Send mail address
rcptto=$1 #
Backup strategy:
Make a full standby every Sunday and make an incremental backup every day.
One: Fully-prepared script
Cat xtrabackup_full.sh
#!/bin/bash
Local_ip= "$ (/sbin/ifconfig eth0|grep ' inet addr ' |awk-f: ' {print $} ' |cut-d '-f1)"
Email=
1. Order Introduction
①locate
The Linux Locate command is used to find documents that match the criteria, and he goes to the database where the document and directory names are stored, looking for documents or directories that conform to the
Brief Introduction
Sed is an online editor that handles a single line of content at a time. When processing, the currently processed rows are stored in a temporary buffer, known as pattern spaces, followed by the SED command to handle the contents
In recent time, when dealing with shell scripts, encountered time processing problems. The addition and subtraction of time, as well as the calculation of timing.
1. Time plus minus
The way to do this is to turn the base time into a timestamp,
[]linux Shell gets the absolute path of the currently executing script
A common misconception is to use the PWD command, which is "Print name of current/working directory," which is what this command really means, the current working directory,
Java EE Development of various types of resources download list, the history of the most complete IT resources, personal collection summary.
Objective:
No matter what programming language is inseparable from conditional judgment. The shell is no
#。 The first sentence in the footsteps, indicating the program used to execute the script
Example: #!/bin/bash
# comments, for help information or for ignoring statements that are temporarily not executed
# This is a comment
$ variable
It's nice to install fish shell today and install oh-my fish.But it is still a preliminary attempt and more features are not known. Install Fish
sudo apt install fishSet as Default shell
Chsh-s/usr/bin/fish
If you want to switch back to bash,
Using variables from the shell in awk
One: "' $var '"
In this way, you don't have to change the habit of using the AWK program, which is commonly used by foreigners. Such as:
var= "Test"
awk ' begin{print ' $var ' "} '
This notation is actually a
Recently learning a Linux script, here is the meaning of $, $, $!, etc. in shell scripts
Variable Description $$The PID of the shell itself (ProcessID)$!PID of the Shell's last running background process$?End code of the last Run command (return
Because of the job needs, because to determine whether rsync is successful, at first I was to judge the local file there is no to that do quiteSafety, now to push the data past, I can not judge, only with the rsyncreturnIn the first place, the '
h=$ (date +%h) s=$ (date +%s) m=$ (date +%m)
if [$h = = && $m = = && $s = = 10]]
A. bash [] single and double brackets
Basic elements:O
[] Two symbols should be separated by a space aroundO
There is a space between the internal operator and the
This shell script is used to obtain the MAC address of the intranet host of the 192.168.4.0/24 network segment in bulk#!/bin/bash#Author:Jink#这脚本使用ping和arp命令获取内网主机的MAC地址,查询到的MAC地址写入到文件中myping(){ ping -c2 -w1 -i0.5 $1 &>/dev/null if [ $? -eq 0 ]
1th Shell Basics 1.1 What is a shellThe shell is a command interpreter, which at the outermost of the operating system, is responsible for directly talking to the user, explaining the user's input to the operating system, and processing the output
Shell script programming includes process control, functions, arrays, advanced string manipulation, and advanced variables, where the main introduction to Process control.Process Control is mainly a process programming language, which is divided
Shell annotationsUse # as the comment symbolThere are no multiple lines of comments in the shell, only one line plus a # numberString manipulation1. Stitching strings 2. Get the string lengthString= "KHJF"echo ${#string}3. Extracting
In Linux, the exec function is not a single function, but a function group, which is:
int execl(const char *path, const char *arg, ...);int execlp(const char *file, const char *arg, ...);int execle(const char *path, const char *arg, ..., char *
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