zoukankan      html  css  js  c++  java
  • 工作常用shell集合

    <1>日志回滚案例======>
    [root@localhost test]# cat hbase.sh
    hbase_rotate_log ()       
    {
        log=$1;
        num=5;
        if [ -n "$2" ]; then
        num=$2
        fi
        if [ -f "$log" ]; then # rotate logs
        while [ $num -gt 1 ]; do
            prev=`expr $num - 1`
            [ -f "$log.$prev" ] && mv -f "$log.$prev" "$log.$num"
            num=$prev
        done
        mv -f "$log" "$log.$num";
        fi
    }
    hbase_rotate_log $1

    [root@localhost test]# ./hbase.sh install.log
    [root@localhost test]# ls
    hbase.sh  install.log.1  install.out.1

  • 相关阅读:
    rockGenmel stone.txt
    WHICHDAY.txt
    WORKDAYS.txt
    WAIT_YN.txt
    WEEKDAYS.txt
    WHEREXY.txt
    KeySelected.txt
    WINDOW.txt
    UPPER.txt
    ParentShapes It.txt
  • 原文地址:https://www.cnblogs.com/itcomputer/p/4702093.html
Copyright © 2011-2022 走看看