shell脚本

脚本1停止lampp

 

#!/bin/bash

#set -xv

count=`ps -ef|grep lampp|grep -v "grep"|wc -l` # ”`”是Tab键上面那个按住shift会出现~符号

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

 

脚本2定时任务

touch /root/zuoye2.sh

vi /root/zuoye2.sh

 

#!/bin/bash       

cat /opt/lampp/logs/access_log > /tmp/`date +%Y-%m-%d`.log  # ”`”是Tab键上面那个

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

 

crontab –e

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

posted @ 2016-10-19 15:51  xiaojinniu425  阅读(94)  评论(0编辑  收藏  举报