首页 > 系统服务 > 详细

shell脚本

时间:2016-10-19 16:51:37      阅读:223      评论:0      收藏:0      [点我收藏+]

脚本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

shell脚本

原文:http://www.cnblogs.com/xiaojinniu425/p/5977573.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!