Compile as script
The basic form of this script is from the rsync website. In fact, there is only one command:
Rsync-force-ignore-errors-delete-excluded-exclude-from = exclude_file-backup-dir = 'date + % Y-% m-% d'-av
Key parameters are:
-Backup:
1. $ # number of parameters passed to the script2. $ * display all parameter variables passed to the script with a single string. Different from location variables, this option can have more than 9 Parameters3. $ ID of the current process running
Shell script application and loop statements
1. bash wildcard:
1 .? // Any single character
2. * // 0 or multiple characters
3. [] // any character in the interval
4.; // split the command, ignore the execution result of the previous command, and
Cat disk. sh#! /Bin/bash
For I in 'df | sed 1d | awk '{print $5}' | sed's/% // g'' ### compare the size of the obtained loop ### #DoIf [$ I-gt 10] ### here, the threshold value is set to 10 to facilitate testing ###ThenDf-lh> disk.txt was added to
Data backup is required for any online e-commerce site. Regardless of version updates or server migration, the importance of backup data is self-evident. Manual data backup not only consumes a lot of time and effort, but is not very professional. As
This script has been tested on ubuntu and centos. The script is as follows:
#! /Bin/bashLine = '============'# Linux release nameIf [[-f/usr/bin/lsb_release]; thenOS = $ (/usr/bin/lsb_release-a | grep Description | awk-F: '{print $2}' | sed's/^ [\ t]
Shell special Variables☞Location variable
1. $0 get the file name of the current script, including the path.
# Write a test script vim test. sh # The content is as follows: dirname $0 basename $0 # execute bash $ (pwd)/test. sh # output the
It is said on the Internet that there was once a fast thunder pen question to add users in batches. The procedure is very simple. There is a small knowledge point. Set a password for the user without interaction. There are two solutions: 1. Reverse
Method for creating random numbers
1 ~~~~
/Dev/urandom
In Linux, a device/dev/urandom is used to generate a random number sequence. With this device, we can generate random strings as needed.
For example, if we want to generate a random password
The generated password and user input can be repeated.Therefore, it may be much more difficult to guess general rules.Current version rules:A -- number pair, location pairB -- after excluding the result of A, the number is correct, but the position
Recently, I have been writing a script to automatically detect the host type in the network. The basic function can be used to determine the host operating system type. If the host is in the domain, you can obtain the host hardware and performance
That is, for example, I have 100 executable files and there is no particular sequential execution relationship between them, as shown in figure
CODE:
job_1job_2job_2.....job_100Want to use csh/bash for multi-thread invocation and execution
For
As we mentioned in the preface, although the Apache server is the most widely used, it is designed to be a very secure program. However, Apache also has security defects like other applications. After all, it is the full source code. The security
Asia Pacific Network Information is recorded here and updated every day.
Http://ftp.apnic.net/apnic/stats/apnic/delegated-apnic-latest
The script below will edit the text and output the CIDR blocks of several major carriers in China.
#! /Bin/sh#
On average, PHP100 has intrusion or attacks every month. We have done a lot of work. Of course, many experts can still intrude into the PHP100. We are not surprised because we believe that there are people out of the world, although our servers are
Use shc to encrypt Shell scripts to improve the security of shell script files.Introduction: When the shell script we write contains sensitive information such as the account and password, we want to enhance the security of the script, and do not
Preface:
Server operation suggestions
1. Operate servers in strict accordance with directory specifications
2. remote servers cannot be shut down
3. Do not run high-load commands during server access peaks
4. Do not force yourself out of the server
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