文件批量备份脚本

#!/bin/bash
date=$(date +%Y-%m%d%H)
bak_path=/application/bs_bak/static
project_path=/www
tmp_path=/tmp/statics
RETVAL=0

# static
test -d "$bak_path"  &&  echo  "$bak_path exists"  || mkdir "$bak_path"  -p
cd $project_path
echo $"Usage: $0 {lngiot-AdminWeb|lngiot-seed|lngiot-view}"
read -p  "Enter your tar project:" tar_project
# tar project=(lngiot-AdminWeb,lngiot-seed,lngiot-view)
 if [ -d "$project_path/$tar_project" ];then
     tar zcf "${tar_project}_${date}".tar.gz   ${tar_project}/
     mv  ./${tar_project}_${date}.tar.gz  $bak_path/
 else
     echo "$project_path/$tar_project is exists"
  fi

分割线
感谢打赏
江西数库信息技术有限公司
YWSOS.COM 平台代运维解决方案
 评论
 发表评论
姓   名:

Powered by AKCMS