简单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脚本,安装上传查询日志的主要内容,如果未能解决你的问题,请参考以下文章

shell脚本:nginx访问日志切割与打包上传

shell脚本:检查ftp日志存储服务器上的日志是否正常上传

shell 脚本二进制安装mysql

shell 脚本二进制安装mysql

python结合shell脚本实现简单的日常集中巡检

如何使用 unix shell 脚本将 impala 查询输出日志转换为变量?