First, through the timing of email to detect network connectivity
Copy Code code as follows:
#/bin/bash
echo "Daily Test mail" > State.txt
Mail-s Server_state Abc@jb51.net Rm-df./state.txt
~
Crontab-e
Add the following
Copy Code code as follows:
#!/bin/bash
#telno for the query number list file
#sendsms. Log send result file for SMS
#1 Rep sent successfully
Query_sms ()
{
>submit_telno
>delivered_telno
>fail_delivered_telno
Cat Telno |while Read line
Use Linux Programmer to enter password This behavior must be not unfamiliar, under Linux to the user has the strict permission limit, does many things crosses the permission to have to enter the password, for instance uses the super user to execute
1. Automatic Ssh/scp method
A is a local host (that is, a machine used to control other hosts);b is a remote host (that is, a controlled machine server), if IP is 192.168.60.110;Both A and B systems are Linux.
To run a command on a:# ssh-keygen-t
Scripts written in Bash can also be debugged, just like Python,perl and other interpreted languages. Create a new script named Servinfo and add executable permissions:
Copy Code code as follows:
$ VI Servinfo
#!/bin/bash
echo
One of the benefits of Git is that the branch management of the code becomes an extremely convenient thing, the branch only retains the difference, does not have to copy any files, does not connect the network, quickly creates, uses is deleted. The
Question: I want to know the process ID of the script shell in the run. How do I get the PID in the shell script?
When I execute the shell script, it starts a process called a child shell. As a child of the main shell, the child shell runs the
Parameters:Pathname, the path file name of the temporary file is stored, and the manual free () is required.Dir, the path to the temporary file, if the TMPDIR environment variable is not empty, this parameter is ignored and the environment variable
A case of a batch conversion directory of File encoded shell script code.
Requirements Description:As a result of turning Linux from Windows, many original win under the GBK file needs to be converted into UTF8.
The following script only judges
When writing programs, we often use timers. First look at the Select function prototype as follows:
Copy Code code as follows:
int select (int Nfds, fd_set *readfds, Fd_set *writefds,
Fd_set *exceptfds, struct timeval *timeout);
Shuffle problem: Wash a pair of poker, what good way? Can be washed evenly, and can wash quickly? What is the efficient implementation of a disorderly arrangement relative to a file?
Chinaunix is indeed the place where the Shell masters are
Copy Code code as follows:
[Root@web-server php]#/etc/init.d/httpd Restart
Shell-init:error Retrieving current Directory:getcwd:cannot access parent directories:no such file or directory
This error indicates that the GETCWD command could
1. When defining a variable, no spaces can be left on either side of the = number.eg:Gender=femal ———— RightGender =femal ——— –wronggender= femal ——— –wrong2. Conditional test statement [Both sides of the symbol must be left blank.eg:if [$gender =
The shell can represent different data in the system without invoking the 3rd party command. The following presentation method is summarized here. The default value of the shell script is handled by the 10 number, unless the number has a special
Copy Code code as follows:
#!/bin/bash
#author: 505056357@qq.com
echo "Backup Job Start"
#设置要备份的网站目录, that is, the root directory of the Web site
File=/home/wwwroot/default
#设置本地备份目录, for storing the packaged files
This iptables script is good, very practical, according to the actual application can be changed to use their own. Share it for everyone to refer to. The original author anon. The source code is as follows:
Copy Code code as follows:
Command substitution means that the Shell executes a command and replaces the command substitution with the result of executing the command.
There are two ways to replace a command:
1. Use backtick symbols (i.e. ..., inverted quotes, accented
It's fun for the terminal print in the shell!First know that the end of the shell print has echo printf is commonly used is echo slightly;
Note: Font Color reset = 0, black = 30, red = 31, green = 32, ***=33, blue = 34, magenta =35, cyan = 36,
Recently saw a few good small examples in the forum, for learning awk is still helpful, here in detail
A. A LEFT join query in a similar database
Copy Code code as follows:
[Root@krlcgcms01 mytest]# cat A.txt//a.txt
aaa
222 BBB
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.