zoukankan      html  css  js  c++  java
  • log4j日志归档

    #!/bin/sh

    logs_dir=/oracle/weblogic/user_projects/domains/webdomain/log4j
    cd ${logs_dir}
    for file in `ls *.log.*`
    do
    app=${file%%.log.20*}
    dt=${file##*.log.}
    dy=${dt:0:4}
    dm=${dt:5:2}
    dd=${dt:8:2}
    target_dir=${logs_dir}/${app}/${dy}/${dm}/${dd}/
    if [ ! -d ${target_dir} ];
    then
    /bin/mkdir -p ${target_dir}
    #echo $target_dir' is not exists'
    fi
    #echo ${file}
    sfile=${logs_dir}/${file}
    #echo ${sfile}
    /bin/mv ${sfile} ${target_dir}
    #echo 'sfile='${sfile}' target_dir='${target_dir}
    done

  • 相关阅读:
    【心情】codeforces涨分啦!
    redis
    rabbitmq
    lucene
    MongoDB
    负载均衡
    分布式存储
    Memcache
    websocket
    Remoting
  • 原文地址:https://www.cnblogs.com/jony413/p/2984942.html
Copyright © 2011-2022 走看看