Ideas:
1, back up yesterday's log, while deleting the five days before the backup data.
2, copy the log file, and set the original log file is empty
Shell
#!/bin/bash
#function: Cut nginx log files
#author Kung
log_path= '/home/wwwlogs/'
~ Represents the current user's root directory/home/username/
/represents all the root directory
. Represents the current directory
Copy files:1. Copy Local files to remoteSCP filename User name @ computer IP: remote path2. Copy files back to local
Introduction to Shell arrays
Time: 2008-01-23 10:57:33 Source: Linux Federation Collection collation Author:
You can also use array variables in bash, which are assigned two types of values: (1) name = (value1 ...
Overview: In Linux shell programming, there are many conditional expressions for comparison/judgment, and this article makes a brief summary of them.
1. String comparison! Take the anti-n str string STR is NOT NULL
-Z str string str is NULL
STR1 =
1. Use shell script get_file_stat.sh statistics The number of directories in the bin directory executable file number, text file number
#!/bin/bashCd/binDir= ' ls-l |grep "^d" | Wc-l 'Exefile= ' Find/bin-perm +111| Wc-l 'Txt_file= ' Find/bin-name "*
What does it mean in the shell that we will see the symbols of $ , $, and $? Simply put is the name of the shell script that you wrote, the first parameter you wrote to your shell script, and the second parameter that you wrote for your shell script.
If the file is a. css file or a. js file, it is processed.file=$1if ["${file##*.}" x = "css" x]| | ["${file##*.}" x = "JS" x];then do somethingfiAttention:1> extract file suffix name: ${file##*.}# #是贪婪操作符, match from left to right, match to the
# Experimental Case One,**Writing sysmon.sh Scripts(1) Use the DF command to extract the disk occupancy of the root partition and assign a value to the variable dug.(2) Use the Mpstat command to extract the CPU usage (Install the SYSSTAT package)
Depending on the Web log or the number of network connections, monitoring when an IP concurrent connection number or a short time PV reached 100, that is, call the firewall command to seal off the corresponding IP, monitoring frequency every 3
The contents of the log file are as follows:logid=2210608107 worker_id=140610281404160 optime=1452598610.631276 msg=service+not+found+in+share+memory service=Redis_doc_pushThe post-column output is obtained through awk, and the disadvantage is that
测试操作符
Common Test Operators
English name
Description
-F file
file
files exist and are normal files True, that is, test expressions are set
-d file
Direct Ory
List of files and directoriesThe most basic form of the LS command displays files and directories under the Pro directoryThe table of contents and files will display color distinctions.If the terminal is not supported in color, you can add the-F
Shell Arrayshell支持一维数组(不支持多维数组),并且没有限定数组的大小。Defining arraysshell中,用括号来表示数组,数组元素用空格分隔,下标从0开始Mode 1 数组名=(值1 值2...值n),如array_name=(value0 value1 value2)Mode 2 array_name=(value0 value1 value2 )Method 3 defines the value of the array
After obtaining the source code of 007 shell, I couldn't compile the source code. After reading the source code, I corrected a small bug and compiled OK.Run "./007 shell-s" on one Linux and "./007 shell-c-h ip_of_linux" on the other linux2 ",A
1. run commands in the background
Cron: System scheduling process. It can be used to run jobs during off-peak hours every day, or during different periods of one week or one month.At: Command. It is used to run some special jobs at a specific time,
I am studying Linux Shell script recently.Linux Shell scripting tutorial (LSST) v1.05r3But because it is in English, it is also a deep impression. Now, go to the topic.
1. How to Write shell script?
A. First, use any Compiler (Vi, Vim, kwrite,...)
I. Use of local variables
Local variables act only in this shell, just like local variables. It does not affect variables in other shells.
1. Show variable valuesYou can use the echo command. Note that you must add the $ symbol before the variable
Cut
The cut command can extract text columns from a text file or text stream.
Cut syntax
[Root @ WWW ~] # Cut-D 'delimiter '-F fields
The PATH variable is as follows:
[root@www ~]# echo $PATH/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/X11R6/
I. Introduction
For the purpose of compressing program resources and registering and protecting program resources, the shell can be divided into two types: Compressed shell and encrypted shell.UPX aspcak telock pelite nspack...Armadillo asprotect
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