自动打包备份网站和数据库脚本for linux

2018/9/25 12:15:00

  此脚本配合linux定时任务来打包文件,可以定时备份网站
  #!/bin/bash
  #author : merci
  function web_backup(){
  WEBPATH="/data/www"
  BACKPATH="/data/back"
  D=$(date +%Y%m%d)
  WEBLIST=`ls $WEBPATH`
  mkdir -p $BACKPATH/$D
  for webpack in $WEBLIST
  do
  tar -zcvPf $BACKPATH/$D/$webpack.tar.gz $WEBPATH/$webpack
  done
  }
  web_backup