首页 > 代码库 > 利用脚本拉取项目日志
利用脚本拉取项目日志
[root@vapp0301 ~]# cat pull_log.sh
#!/bin/bash
#date=2014-09-16
#is to pull the app log
echo -ne "\033[31m \033[05m the time format of the risk and bp is %Y-%m-%d %H:%M:%S.the pos is %H:%M:%S\033[0m"
read -p "please input your app": APP
read -p "please input your time interval": TIME1
read -p "please input your time interval again": TIME2
case $APP in
pos)
cd /usr/local/jboss/server/jboss-pos/log
sed -n "/^${TIME1}*/,/^${TIME2}*/p" pos.log >/root/pos21.log
gzip -9 /root/pos21.log
;;
ris)
cd /usr/local/jboss/server/jboss-ris/log
sed -n "/^${TIME1}*/,/^${TIME2}*/p" server.log > /root/risserver21.log
gzip -9 /root/risserver21.log
;;
bpl)
cd /usr/local/jboss/server/jboss-bpl/log
sed -n "/^${TIME1}*/,/^${TIME2}*/p" server.log > /root/bplserver21.log
gzip -9 /root/bplserver21.log
;;
*)
echo "please input right app"
;;
esac
本文出自 “路由汗水交换成功” 博客,请务必保留此出处http://ghnhl.blog.51cto.com/1630025/1553278
利用脚本拉取项目日志