Shell script to split nginx logs

#!/bin/bashLogs_path= "/opt/nginx/logs/"Pid_path= "/opt/nginx/logs/nginx.pid"MV ${logs_path}access.log ${logs_path}access_$ (date-d "Yesterday" + "%y%m%d"). LogKILL-USR1 ' Cat ${pid_path} 'Crontab-eXX * * * * sh/opt/shell/cutnginx.shThe script

Shell Script (vii)

Shell Script (vii)J, Array#关联数组: A generic array index must be a numeric value, and an associative array index can be a string#也可以是数值, similar to a Python dictionaryawk ' BEGIN {str[name]= ' string '; str[1]= "1"};p rintf ("%s\n%s\n", str[name],str[1

Description of the IF, while, for statement for the shell of Linux

I. Basic conditions of judgment1) Logical operators-A expr1-a expr2 logic and-O expr1-o expr2 logic or! !EXPR1 Logical Non-2) Numerical judgment-eq num1-eq num2 is equal-ne Num1-ne num2 is not equal-GT NUM1-GT num2 is greater than-ge Num1-ge num2 is

Shell Login Remote Server

More field servers, password 3 months expired, at the expiry of the need to change the password.Write with expect, try to log in 2 times after the exit (Prevent password error when the account lockout), time-out retry.The shell script calls and

Shell Monitoring Script 3

#!/bin/sh#count memory_used_rate,disk_used_rate # @yuanwb  2015-5  #disk_used_rate #depend  on real storage place the parameter  ' Location '  need to  Alter. location=/dev/sda1disk_used_rate1=$ (df -h | grep  $Location  | awk  ' {print $5} ') free1=

Shell Operation Memcache

[email protected] mc]# cat mc.sh#!/bin/bashfunction Random {mc0= "192.168.8.62 7510"#MC1 = "192.168.30.22 7510"Case "$ (expr $ (date +%s%n) \% 2)" in0)Mc= "$MC 0";;1)mc= "$MC 1";;Esac}> Set-result.txt> Get-result.txt> Delete-result.txtFor ((i=0;iDoa=

Select usage in the shell

Select is also a kind of loop, it is more suitable for use in the case of user choice.For example, we have one such requirement, after running the script, let the user go to select the number, select 1, run the W command, select the 2 run Top

Shell script Implementation Tetris

Draw is to draw out the graphical interface keytest is to get the keyboard Tetris is the whole gametetris.sh#!/bin/bashapp_name= "${0##*[\\/]}" app_version= "1.0" #颜色定义iSumColor =7# total colors cred=1# red cgreen=2# green cyellow=3# Yellow cblue= 4#

Shell Learning Notes VI (Test and judgment)

Test and judgment tests use the $ after command execution to determine if the command is performing properly. $?==0? Normal: Error test structure: 1, test expression 2, [expression] #注意表达式两侧的空格 mode 2 increases the readability of the code, and more

Linux Shell six flow control--loop

One, for loop The For loop works by taking the serial element one by one out, putting it into the specified variable sequentially, and repeating the contained command area (between do and done) until all the elements takeUntil the end. Where serial

Use the shell to count the number of occurrences of the Top10 URL (not found in the blog Park, special Turn)

transferred from: http://blog.csdn.net/guaguastd/article/details/8332757use the Shell to count the number of occurrences Top10 URLsCategory: Shell scripts 2012-12-19 17:17 286 people read reviews (0) favorite reports Ranking of

Shell calculation string length method and speed comparison

Tag: Shell calculates string length chars= ' seq-s '; echo $chars 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32  33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

Msfpayload Rebound Shell

1, Prophase--The situation is when we get Webshell, we want to leave our back door, this time we can use Msfpayload and msfconsole togetherStart PostgreSQL Service: Service PostgreSQL start start Metasploit Services: Service Metasploit start start

Linux Learning Notes-The 12th lesson-shell Script's regular expression (i)

First, Grep,egrep,fgrep1) grepFormat: grep [options] [mode] [file name]Common options:-N: Display line numbers and matching rows-V: Reverse match-C: No matching rows are displayed, only the number of matching rows is displayed-I: Ignore case-R:

Linux issue: Crontab a problem with relative paths when executing shell scripts, not recognized.

Problem Description: The direct execution shell script in Linux can find the file with a relative path, but if you execute the shell script through the scheduled task crontab, you cannot find the file by relative path!Example:Shell script file Code ~

shell--Mathematical Calculation

The assignment and operation in the shell is the string processing by default, here are some special methods of mathematical operation in the shell, which can be seen later, hehe1. Examples of error methodsAVar=1+1Echo $varThe result of the output

The use of the CD command in the shell script

When writing the shell script to find that the CD switch directory can not switch, the code is the following.1 #!/bin/bash2#changedir. SH3history4 cd/home/ Firefox516 pwdI think carefully, I carry out the time is. Changedir.sh to execute, so that

(031) The shell location parameters of Linux

Fundamentals of the ten-year OPS series-LinuxZeng LinContact: [Email protected]Website: www.jplatformx.comCopyright: Please do not reprint the article without permission First, IntroductionWe have not had the ability to receive and process

Shell theory Study (iv)

Take a string slice 1. Starts with the fourth string, intercepts the string to the end of the string[Email protected] ~]# myname= "Hello myworld" [[email protected] ~]# Substr=${myname:3}[[email protected] ~]# echo $substr Lo MyWorld2. Starting

Shell-based variables

Shell-based variablesVariable typeShell variables include environment variables, location variables, pre-defined variables, and custom variables.Environment VariableShell environment variables are a type of Shell predefined variables used to set the

Total Pages: 541 1 .... 273 274 275 276 277 .... 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.