我试图让备份脚本适用于rackspace。它将备份发送到服务器的最后一部分是无效的。
#!/bin/sh
#Set information specific to your site
webroot="/mnt/stor08-wc1-ord1/666666/www.mysite.com/"
db_host="mysql51-900.wc1.ord1.stabletransit.com"
db_user="666666_backup"
db_password="PassBackup2015"
db_name="666666_wealth"
#Set the date and name for the backup files
date=`date '+%F-%H-%M'`
backupname="backup.$date.tar.gz"
#Dump the mysql database
mysqldump -h $db_host -u $db_user --password="$db_password" $db_name > $webroot/db_backup.sql
#Backup Site
tar -czpvf $webroot/sitebackup.tar.gz $webroot/web/content/
#Compress DB and Site backup into one file
tar --exclude 'sitebackup' --remove-files -czpvf $webroot/$backupname $webroot/sitebackup.tar.gz $webroot/db_backup.sql
HOST='172.0.0.1'
USER='FILESERV\ftp'
PASSWD='PassBackup2015!'
ftp $HOST <<END_SCRIPT
user $USER $PASSWD
cd $webroot
put $backupname
quit
END_SCRIPT
exit 0
答案 0 :(得分:0)
您可能需要使用ftp -n
来阻止自动登录的发生。使用user
命令进行自动登录通常会导致问题。
换句话说,比如:
ftp -n $HOST <<END_SCRIPT
user $USER $PASSWD
cd $webroot
put $backupname
quit
END_SCRIPT