Script 1 stop it lampp

#!/bin/bash

#set -xv Turn on debugging mode ?

count=`ps -ef|grep lampp|grep -v "grep"|wc -l`  # ”`” yes Tab Press and hold the key above shift There will be ~ Symbol , remove grep Its own command counts the number of lines

if [ $count -gt 0 ] # Greater than one indicates that a process has started

then

ps -ef|grep lampp|grep -v "grep"|awk '{print $2}' | xargs kill -9 #awk Go to the second one , Is a process, ,xargs It's killing them all

echo 'lampp has stopped...'

else

echo 'lampp is not running...'

fi

Script 2 Timing task

touch /root/zuoye2.sh

vi /root/zuoye2.sh

#!/bin/bash

cat /opt/lampp/logs/access_log > /tmp/`date +%Y-%m-%d`.log  # ”`” yes Tab The one above the key , Redirect to another file

cat /dev/null > /root/test.txt # Clear this file

crontab –e

59 23 * * * bash /root/zuoye2.sh # Set up scheduled tasks

Script 1 stop it lampp

#!/bin/bash

#set -xv

count=`ps
-ef|grep lampp|grep -v "grep"|wc -l` 
# ”`” yes Tab Press and hold the key above shift There will be ~ Symbol

if [ $count
-gt 0 ]

then

ps -ef|grep
lampp|grep -v "grep"|awk '{print $2}' | xargs kill -9

echo 'lampp
has stopped...'

else

echo 'lampp
is not running...'

fi

Script 2 Timing task

touch /root/zuoye2.sh

vi /root/zuoye2.sh

#!/bin/bash

cat
/opt/lampp/logs/access_log > /tmp/`date +%Y-%m-%d`.log  # ”`” yes Tab The one above the key

cat
/dev/null > /root/test.txt

crontab –e

59 23 * * *
bash /root/zuoye2.sh

Two shell More about scripts

  1. Shell Script learning lesson two ·

    Shell File contains shell You can also include external scripts , The syntax is as follows : . filename or source filename For example, create two shell Script . Script 1:test1.sh url = &quo ...

  2. shell Script learning - File contains

    follow RUNOOB Website tutorial learning notes Like any other language ,shell You can also include external scripts . This can easily encapsulate some common code as a separate file .shell There are two forms of syntax that files contain . filename  # ...

  3. How to learn quickly Shell Script ? turn

    How to learn quickly Shell Script ?   Catalog Writing ideas Knowledge system Shell Language as a class Unix The native script of the system , It has very practical value . But for a lot of new contacts Shell Script students , understand Shell Language ...

  4. Shell scripting ( Two ):shell Variable

    Defining variables When defining variables , Variable name without dollar sign ($,PHP Variable needs in language ), Such as : your_name="runoob.com" Be careful , There can be no spaces between variable names and equal signs , It's probably the same with all the programming you're familiar with ...

  5. How to learn quickly Shell Script ?

    Shell Language as a class Unix The native script of the system , It has very practical value . But for a lot of new contacts Shell Script students , understand Shell The grammar of language is a very difficult thing . Some even make complaints about it , Maybe no one knows ...

  6. linux Next use shell Script automation deployment project

    stay Java When developing a project, it is often necessary to publish the developing project to the test server for testing , Generally speaking, the project should be typed as war package , And then put war The package is published to the server , Shut down the server , Finally, restart the server , Although the process is not very cumbersome , But if it's multiple ...

  7. shell Script : utilize 7z Backup git project

    notes : nothing git See :tar or 7z Backup projects The first use of homebrew install p7zip $ brew install p7zip Then use two shell Script : backupProject.sh Meeting ...

  8. Shell Script 9 I / O redirection and file containing

    Output redirection : It means not using the standard input port provided by the system to output , It's to reassign something else to output . For example, the input string in the terminal was originally to be output to the terminal screen , But you can specify the output as a different file , Output the input string to the file , Not on the screen ...

  9. Shell Script Global variables 、 local variable

    In different scopes , Variables with the same name don't interfere with each other , It's like A There is a classmate named Xiao Ming in our class ,B There is also a classmate named Xiao Ming in our class , Although they are all called Xiao Ming ( Corresponding to the variable name ), But because of the class ( Corresponding to the scope ) Different , So it won't cause chaos . But if ...

Random recommendation

  1. Emmet Use it HTML

    Preface I found a powerful and interesting thing on the Internet some time ago ,emmet, It can facilitate our front-end developers to quickly write html and css. It can be regarded as a necessary tool for front-end development , Let's sum up today emmet Write html, Let's sum it up when we have time css Of ...

  2. python modular app Login authentication (M2Crypto Digital certificate encryption )

    demand : 1. Through digital certificate , Asymmetric encryption transfers symmetric secret key to server 2. user name . The password is encrypted with a symmetric secret key , Send server verification 3. Data is transmitted in byte stream mode Realize the idea : 1. understand python Of struct modular , For bytes ...

  3. HDU 4925 Apple Tree( Simulation question )

    Topic link :http://acm.hdu.edu.cn/showproblem.php?pid=4925 Problem solving report : Here you are. n*m The land of , Now there are two operations for each piece of land , At most two operations can be performed on each piece of land , The first one is ...

  4. retrieval COM Class factory CLSID by {000209FF-0000-0000-C000-000000000046} Component of failed , The reason is the following error : 8000401a Because the configuration ID is incorrect , The system was unable to start the server process . Please check your username and password . ( Exception from HRESULT:0x8000401A).

    retrieval COM Class factory CLSID by {000209FF-0000-0000-C000-000000000046} Component of failed , The reason is the following error : 8000401a Because the configuration ID is incorrect , The system doesn't work ...

  5. Struts2 File upload function analysis

    This article will take image upload as an example , analysis Struts2 The main process of file upload, the function of instance :1. stay jsp Page select the image to upload ,                 2. Name the image to be uploaded , For easy search               ...

  6. BZOJ 1212 HNOI2004 L Language AC Self driving machine (Trie Trees )+ Dynamic programming

    Title Effect : A list of given words , and m strand Each string q The longest prefix , This prefix can be split into strings There are too many words in these strings No longer afraid of the wrong data range -- There's an obvious one Trie I wrote about the problems that trees can solve AC Self driving machine ...

  7. 3553: [Shoi2014] The trigeminal tree ( The tree chain splits )

    This question is particularly disgusting , The first thing we can see is that there is a continuous one or two , So use the line tree + Tree chain dissection finds this range It's not hard to think of , It's just disgusting = = CODE: #include<cstdio> #i ...

  8. vscode c++ cmake template project

    VSCode configure C++ dev environment claim use CMake to build the project. For debugging, VSCode's C ...

  9. [Jsoi2013] happy jyy

    subject This needs us to be blind \(yy\) You can do it in a minute Let's start with the first string \(PAM\) We drop the second string to match , What is matched here is the length of the longest palindrome suffix that ends at each position and exists in another string For every position open ...

  10. flask request hook 、HTTP Respond to 、 response message 、 Redirect 、 Return the error code manually 、 modify MIME type 、jsonify() Method

    request hook : When we need to preprocess and postprocess a request , You can use it Flask The callback function provided ( hook ), They can be used to register processing functions that are executed at different stages of request processing . These request hooks are implemented using decorators , Through the program example app call , With b ...