mysql 备份解密脚本

#!/bin/bash
#by sk 备份解码脚本
echo "-------------------------------------------------"
function getdir(){
    #echo $1
    for file in $1/*
    do
    if test -f $file
    then
            echo $file
            if [ "${file##*.}" = "xbcrypt" ] ; then
                echo ${file%.*}
                xbcrypt -d --encrypt-key=jiamistring --encrypt-algo=AES256 -i $file -o ${file%.*}
                rm -rf $file
            fi;
            #arr=(${arr[*]} $file)
    else
            getdir $file
    fi
    done
}

function getdirrm(){
    #echo $1
    for file in $1/*
    do
    if test -f $file
    then
            echo $file
            if [ "${file##*.}" = "xbcrypt" ] ; then
                rm -rf $file
            fi;
            #arr=(${arr[*]} $file)
    else
            getdir $file
    fi
    done
}
#注意修改文件目录位置
getdir /data/backup/full/2018-02-01_16-55-43
getdirrm /data/backup/full/2018-02-01_16-55-43




#echo  ${arr[@]}
echo "----------------------------------------------------"

  

posted @ 2018-12-12 10:26  东哥加油!!!  阅读(141)  评论(0编辑  收藏  举报