shell脚本[日志搜索]

Reading time ~4 minutes

此文章为原创文章,引用请标记文章出处: shell脚本[日志搜索]

例子:sgrep.sh “查找的字符串” [文件名全称]

    #!/bin/bash

    #echo "app name is $1"
    condition=$1
    filePath=$2
    app_name="crmtask_236_1"
    g_operation="sgrep"
    user="crmtask1"
    host="132.126.2.236"
    passwd="XXXX"
    libPath="/data/crm/crmtask1/tomcat/webapps/crmtask/WEB-INF/lib"
    myLogPath="${libPath/%WEB-INF\/lib/myLog}"
    expect << EOF
        set timeout 2
        spawn ssh ${hostInfo}
        expect {
            "yes/no" {send "yes\r";exp_continue}
            "password:" {send "${password}\r";exp_continue}
            "Permission denied*" {send_user "invalid password or account\n";exit}
        }
        expect "]*"
        send "cd ${myLogPath}\r"
        send "grep \"${condition}\" ${filePath}\r"
        send "exit\r"
        expect eof
EOF
    echo "sgrep $1 over!"

jdk-timer、spring-task、quartz的比较

这篇文章将简单介绍目前常用的定时任务框架! Continue reading

小岛经济学-读书笔记

Published on May 10, 2018

java常见的http请求库

Published on May 05, 2018