Script 1 Stop Lampp
#!/bin/bash
#set-XV Open debug mode?
Count= ' Ps-ef|grep lampp|grep-v "grep" |wc-l ' # "" is the TAB key that holds down shift to appear ~ symbol, excluding the command count lines of grep itself
If [$count-GT 0] # greater than one indicates that a process has started
Then
Ps-ef|grep lampp|grep-v "grep" |awk ' {print $} ' | Xargs kill-9 #awk去第二个, is the process number, Xargs is all killed
Echo ' Lampp has stopped ... '
Else
Echo ' lampp is not running ... '
Fi
Script 2 timed Tasks
touch/root/zuoye2.sh
vi/root/zuoye2.sh
#!/bin/bash
Cat/opt/lampp/logs/access_log >/tmp/' Date +%y-%m-%d '. Log # "'" is the TAB key above, redirected to another file
Cat/dev/null >/root/test.txt #清空这个文件
Crontab–e
* * * * * bash/root/zuoye2.sh #建立定时任务
Script 1 stop lampp
#!/bin/bash
#set-XV
Count= ' Ps-ef|grep lampp|grep-v "grep" |wc-l ' # " " is the tab key above that hold shift will appear ~ Symbols
If [$count-GT 0]
Then
Ps-ef|greplampp|grep-v "grep" |awk ' {print $} ' | Xargs kill-9
Echo ' Lampphas stopped ... '
Else
Echo ' Lamppis not running ... '
Fi
Script 2 timed tasks
touch/root/zuoye2.sh
vi/root/zuoye2.sh
#!/bin/bash
Cat/opt/lampp/logs/access_log >/tmp/' Date +%y-%m-%d '. Log # "'" is the tab key above the
Cat/dev/null >/root/test.txt
Crontab–e
* * *bash/root/zuoye2.sh
Two shell scripts