请帮助我。我的备份脚本中有一个错误。上传 curl ftp 时文件大小为 0 字节。并剪切文件名:“siteru=2013-09-27(17”。为什么?
执行脚本时,没有错误。上传到ftp完全达到100%
#!/bin/bash
#
#ver 1.0
#2013-09-09
#
DBHOST="mysql-host"
DBUSER="mysql-user"
DBPASS="mysql-pass"
DBNAME="mysql-db"
DBARC=$DBNAME.sql.gz
#
WEBDAVURL="ftp-url"
WEBDAVUSER="ftp-usr"
WEBDAVPASS="ftp-pass"
#
SCRIPTDIR="/home/site/site.com/docs/backup/"
SCRDIR="/home/site/site.com/docs/"
SCREXCLUDE="backup"
SCRARC="site-com.tar.gz"
#
ARCNAME="sitecom"=$(date '+%F(%H:%M)')".tar"
MAXARC="20"
#
cd $SCRDIR
#
tar cfz $SCRIPTDIR$SCRARC --exclude=$SCREXCLUDE *
#
cd $SCRIPTDIR
#
mysqldump -h$DBHOST -u$DBUSER -p$DBPASS $DBNAME | gzip > $DBARC
#
tar cf $SCRIPTDIR$ARCNAME $SCRARC $DBARC
#
curl --upload-file $ARCNAME ftp://$WEBDAVUSER:$WEBDAVPASS@$WEBDAVURL
#
rm *.gz
#
ls -t *.tar | tail -n+$MAXARC | xargs rm -f