简单shell脚本,安装上传查询日志

Posted 牧阳人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单shell脚本,安装上传查询日志相关的知识,希望对你有一定的参考价值。

1、安装:yum -y install lrzsz      

lrzsz:代替ftp上传和下载的程序,centos 和 redhat支持该命令

 

2、上传.sh格式:Rz 

 

3、脚本

#!/bin/bash
echo "-------------------start------------------------"
read -p "enter ip:" ip
read -p "enter key_word:" key_word

cat logs/${ip}/*.out | grep -n -C10 ${key_word} | tail -20
cat logs/${ip}/*.out | grep -n -C10 ${key_word} | tail -20 >tmp.log

echo "-------------------Find Finished-----------------"

 

4、执行

a、Sh  xxx.sh;

b、1)Chmod 777  xxx.sh;

2)./xxx.sh

 

以上是关于简单shell脚本,安装上传查询日志的主要内容,如果未能解决你的问题,请参考以下文章