There are several ways to see what shell you are currently using, and the easiest way is to use the shell's special parameters.
First, a special parameter named "$$" represents the PID of the shell instance that you are currently running. This
Today, when deployed in Jenkins, because developers frequently submitted code, resulting in Jenkins shell script in that frequent deployment, in order to prevent such problems, a special search to prevent the recurrence of code. Here's a look at the
If memcached has been installed in Linux and is deployed to the/usr/local/memcached path, next we will begin to install service management scripts for it to start and stop.
First of all, through VI in the/ETC/RC.D/INIT.D path to create a new script
After testing, the script does not set up!!
The site uses a number of methods to accelerate (REDIS\CDN), this reduces user access to back-end MySQL pressure, as well as the front-end speed is not very good problem, the user requested to all the
To have a holiday, today is really idle egg pain, originally just want to write a configuration iptables script, did not expect to be so complicated by their own, or to share out to everyone, interested can change their own.PS: This script only
#!/bin/sh #本脚本为守护进程, , automatic restart process Function check_and_kill_and_start () {log_file=$1 If a process zombie is found
Name=$2 dead_duration=$3 # echo "check the progress " $ps _name ymd=$ (date +%Y-%m-%d) Log_file=${log_file}${ymd}.log
Workaround:
1. Use split command to cut large files, save 1 million lines per small file
Split parameter:
-B: The following can be divided into the file size, can add units, such as B, K, m, etc.;-L: Split by number of rows;
#按每个文件1000行来分割除
The company server has been dying for the last two days because of the full memory usage. Really can't stand the old call room to help people to restart, specifically wrote a script to release the memory, of course, this server is not too important,
The code is as follows
Copy Code
#/bin/bash #Author Alex Fang. Updates may apply soon. Clear echo "Press AnyKey to continue ..." $anykey; Read AnyKeyecho "bbbbbbbbbbbaaaaaaaaaaaaaaaaaaaasssssssssssssssssshhhhhhhhhhhhhhhhhhhh!"echo
Principle and simplicity: recursion, iconv
code is as follows
copy code
#!/bin/sh tgt= "Source_rst" Function Fe_convert () { for file in ' ls $ ' do if [-D $/' $fi Le] then
Requirements Analysis:
1, SSH Public key copy, provide no password management.
2, batch synchronization hosts files to more than one host.
3. Batch modification of host name.
Realize:
First edit a Hosts file for synchronization to multiple
Objective
Now every time you analyze the site log, you need to judge Baidu Spider is not the real spider, nslookup after the need to determine whether the results include "Baidu" string
Here are some of the methods that are included in the
Determines whether a specified script is a syntax error, and if there is an error, prompts the user to type Q or Q to ignore the error and exit, and any other key can open the specified script via vim;#! /bin/bashScript_file= "./test.sh"Sh-n $script
This script is used in the common shell syntax of the work, the trivial grammar together can help to deal with work, liberation of manpower.The main common shell knowledge points:
Determine if the parameters exist and determine the number
The script is as follows:#! /Bin/bash# Nginx access log segmentation shell script# Log DirectoryLog_dir = "/usr/local/nginx/logs /"Cd $ log_dirTime = 'date + % Y % m % d -- date = "-1 day "'# Log Retention daysSave_days = 15# Location where the log
1. Added the shell script vi/etc/rc. d/init. d/nginx. The code is as follows:Copy code #! /Bin/bash# Chkconfig: 35 85 15# Description: Nginx is an HTTP (S) server, HTTP (S) reverseSet-ePATH
Online servers generally encounter a variety of log cutting. Similar detailed script articles have not been published before. This time, we will make up for the relevant content of the website. The following describes how to cut two logs, and how to
A few commandsThe script is based on the preceding log format. If your log format is different, you need to adjust the parameters following the awk.Analyze the UserAgent in the log The code is as follows:Copy code Cat access_20130704.log | awk-F
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.