Shell practice: use shell to implement squid daemon 01 use shell to implement squid daemon 02 check the squid service status every two minutes. if the squid service is no longer running, start it, scripts for daemon 03 are as follows: 04! Binsh05codebyscpman06mail: scpman @ shell practice: use
Label: blog file SP Div Problem C on log Linux
Category:
You can execute another shell script (or non-executable file, mainly used to obtain the value of some variables) in one shell script :. file name (including path) or variable = file name (including path ). $ variable Note: there is a space behind the dot. In this way, some variables declared in other files can be referenced in the later part of this
Here are just a few common shell commands, some commands that require root user privileges, see: PHP executes shell commands with root privilegesPHP executes shell commands and can use several functions:String system (string $command [, int $return _var]) string exec (string $command [, array $output [, int ; $return _var]]) void PassThru (string $command [, i
1, in the assignment statement Name=value can not have a space, for example: name = value of the form is considered to be three variables, because essentially, the content of the script is passed to the shell program variables, and the variables are separated by a space. If you want a space in value, you need to quote it in quotation marks, and the content of the variable you want to apply is marked with a ' $ ' symbol before the variable name, as fol
function allows us to divide a complex function into several modules, which makes the program structure clearer and the code reuse more efficient. Like other programming languages, the Shell supports functions as well. The Shell function must be defined before use.The Shell functions are defined in the following format:Function_name () { List of commands [r
When deploying a task, one of the necessary procedures is to send some files, such as installation packages, to a large number of servers. Although there is already a Brother Woo script available: A Python script written by the SSH and SCP features provided by the Paramiko module. But I'm still in the fear of Python (though I've worked hard in my spare time), so I've written this batch SCP scripting tool using a combination of shell and expect scripts
1. Background
When multiple processes may perform operations on the same data, these processes need to ensure that the other processes are not operating to prevent damage to the data. Typically, such a process uses a "lock file", which means that a file is created to tell other processes that they are running, and that a process that operates the same data is considered to be working if the file is detected. The problem is that the process accidentally dies and does not clean up the lock file
Linux shell BASICS (6) and Linux shell Basics6. Detailed description of Shell script programming links the content of the above five parts to increase understanding of Shell 01. shell script shell: ## perl # python # php # Differe
Easily use the "Explain Shell" script to understand Shell commands
When we work on Linux, everyone will find the help information of shell commands. Although built-in help such as man pages And whatis commands are helpful, the output of man pages is very lengthy unless it is a person with Linux experience, otherwise, it is very difficult to obtain help informatio
In daily life, random numbers are actually often encountered, want to throw dice, lottery, and draw lots. Oh, very simple can be achieved. So in doing programming, really to design a random number through their own program that is really not easy. Now a lot of the operating system kernel will provide the appropriate API, these raw parameters are to get some computer to run the original information, such as memory, voltage, physical signal, etc., its value in a time period can be guaranteed to be
The wscript. shell and shell. application components are used to execute the program. Therefore, they are the least secure component. Currently, many asp Trojans use wscript. shell to execute commands, ignoring shell. application. We can first upload a bat file in a directory with the running permission, and write the
Variable array in C Shell, shell variable array
Today I was just reading a bit of C Shell Content and found a very interesting thing! Environment variables can be set like arrays! The specific setting syntax is as follows:
Set variable = (element1 element2...) // note that elements are separated by spaces.
For example, if I run the set var = (123 def hij) Stat
Shell Command Line writing rules
An understanding of the basic functions of shell command lines helps to write better Shell programs. When executing shell commands, multiple commands can be run on one command line, but the semicolon (;) must be used at this time (;) separate commands, for example:
[[Email protec
As mentioned above, variable names can only contain numbers, letters, and underscores, because some variables that contain other characters have special meanings. Such variables are called special variables.
For example, $ indicates the ID of the current shell process, that is, PID. See the following code:
Copy text-only new window
$ Echo $
$echo $$Running result
29949
Special Variable list
Variable
Description
$0
F
1. Data type:StringArray2. Naming conventions for variables:Can only start with a-Z or a-ZCannot have spaces in the middle, you can use _Punctuation cannot be usedCannot use the SHELL keyword3. Variable type:Environment variablesLocal variablesShell variables4. StringStrings are the most common and useful data types in shell programming (except numbers and strings, and no other type works well), strings can
Shell-5.shell echo CommandEcho---display contentFormat: Echo [options] Text-N Do not wrap in the last line-E parsing escape character\a issued a warning sound\c Finally, no newline symbol is added.\f Line break\ r Enter1.-N do not wrap in the last line[[email protected] ~]# Echo-n "My name is"; echo "Yuanji"My name is Yuanji[[email protected] ~]# echo "My name is"; echo "Yuanji"My name isYuanji2.-e parsing
I. Declaration and reference of variables in the shell[[email protected] ~]# Var1=hello[[email protected] ~]# echo $var 1hello[[email protected] ~]# echo ${var1}worldhelloworldIn the shell, a reference to a variable uses $.In the above code, $var 1 is a reference to the variable var1, and the result of the output is hello.If you want to link other characters, place the variable inside the curly braces {}, a
Open a text editor, create a new file with the extension sh (sh for Shell), and the extension does not affect script execution.Enter some code:
#!/bin/bash
echo "Hello world!"
"#!" is a contract tag that tells the system what interpreter the script needs to execute, even if it uses a shell. The echo command is used to output text to a window.There are two ways to run a
Path Type flags
/DEV/ROOT/EXT3 (rw)
/PROC/PROC proc (rw)
/dev/mapper/lvmraid-home/home ext3 (rw,noatime)
Finally, we can set an alias for Nicemount
$ nicemount () {(echo "DEVICE PATH TYPE FLAGS" mount | awk ' $2=$4= "; 1 ') | column-t;}
Try it.
$ nicemountdevice PATH TYPE FLAGS
/DEV/ROOT/EXT3 (rw)
/PROC/PROC proc (rw)
/dev/mapper/lvmraid-home/home ext3 (rw,noatime)
2. Run the previous Shell command and
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.