A simple shell script to find out if a critical service is running and is suitable for Linux or UNIX operating systems.The script can also send notifications using e-mail.
Code:
Copy Code code as follows:
#!/bin/bash
#
When the server pressure is larger, running very laborious time. We often do Site page optimization, will go to find those pages are more frequent, and more time-consuming. Find the addresses that are high and time-consuming, and the related
Create 500,000 files first
Copy Code code as follows:
Test for I in $ (seq 1 500000)
For> do
for> echo Test >> $i. txt
For> Done
1 RM
Copy Code code as follows:
Test Time Rm-f *
Zsh:sure you want to
1. Preface
Time is very important to the operating system, from the kernel level to the application layer, the time expression and precision of the same. The Linux kernel uses a constant named Jiffes to compute the timestamp. Application layer has
Linux hardware devices in the/dev directory, the optical drive is one of them./dev/cdrom represents the optical drive, the method of mounting the optical drive is as follows (in root):
Copy Code code as follows:
Mkdir/mnt/cdrom
1.CD-The function is to quickly switch to the previous directory , as follows:
Copy Code code as follows:
amosli@amosli-pc:~$ CD learn/fd/
amosli@amosli-pc:~/learn/fd$ CD-
/home/amosli
2.dirs: Display the directory stack,
1.ls-d *
Copy Code code as follows:
amosli@amosli-pc:~$ ls-d *
%appdata% Develop many Sorted.txt workspace
Bank Documents Music Space Download
2. Find.-type d-maxdepth 1
If you do not add-maxdepth parameters, then
Category: Programs
WshShell objects
ProgID Wscript.Shell
FileName Wshom.ocx
CLSID f935dc22-1cf0-11d0-adb9-00c04fd58a0b
IID f935dc21-1cf0-11d0-adb9-00c04fd58a0b
The following table describes the properties associated with the WshShell
On the internet to see this single flow of the script, very good.
Copy Code code as follows:
#!/bin/sh
Usage () {
echo "Usage: $ [i INTERFACE] [-S INTERVAL] [-C COUNT]"
Echo
echo "-I INTERFACE"
echo "The interface to monitor, and
As a Linux SA, many parts of the day-to-day operation of the script, and the server's IP is generally static IP or Mac binding, of course, the latter is relatively cumbersome to operate, and the former we can set the host name, IP information,
Do unix/linux under the development, scripting skill is indispensable, as Shell programming, is also a profound technical field, here in order to learn, write a simple IP address is the legal micro-script program, this small program is also very
Because I've been working on some JSON data formats recently, I finally found JQ this great tool after a search. JQ allows you to manipulate JSON directly under the command line, including slicing, filtering, converting, and so on.Let's use a few
The general shell script debugging is basically echo to deal with the larger script when, it is more trouble, out of the question, is not very good to locate which line of code problems.In fact, some of the variables built into the shell can be a
1. Operator (let marker)
+ Addition-Subtraction* Multiplication/Division* * Power operation3 Let "z=5**3"% modulobash$ Expr 5% 3
2. The comparison character (note [] and the variable need Space "")
Integral type comparison character-eq equals,
The code is as follows:
Copy Code code as follows:
#! /bin/bash
function Read_file () {
For line in ' cat $ '
Todo
If [' Echo $line |grep ' ^[a-za-z0-9_-]*@[a-za-z_-]*\.[ a-za-z_-]*$ "'];then
echo $line >> Result.txt
Else
There are a lot of ways, and here are three ways to write:
Writing a:
Copy Code code as follows:
#!/bin/bash
While Read line
Todo
Echo $line
Done
Writing two:
Copy Code code as follows:
#!/bin/bash
Cat
Recently more busy, for a long time did not update the blog, today is not busy writing a traffic monitoring script. The test has passed under the CentOS, has the need friend to try, has the bug or needs to add other function words can leave a
Because of the study of PHP, I also installed a XAMPP integrated environment package under Linux. But every time you start to enter the terminal, and then point Open/opt/lampp/, then sudo to perform manager-linux-x64.run operation, to open the XAMPP
Today on the Internet to see a web connection average time of the shell command, in their own machine tried, found that can not use, incredibly appear awk:fatal:division by zero attempted such a mistake, Mao's own changed the shell command.
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