FTP CRON 传输脚本问题
Issue with FTP Transfer Script for CRON
我正在尝试获取适用于机架空间的备份脚本。将备份发送到服务器的最后一部分不起作用。
#!/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
您可能需要使用ftp -n
来防止自动登录的发生。使用 user
命令的自动登录经常会导致问题。
换句话说,类似于:
ftp -n $HOST <<END_SCRIPT
user $USER $PASSWD
cd $webroot
put $backupname
quit
END_SCRIPT
我正在尝试获取适用于机架空间的备份脚本。将备份发送到服务器的最后一部分不起作用。
#!/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
您可能需要使用ftp -n
来防止自动登录的发生。使用 user
命令的自动登录经常会导致问题。
换句话说,类似于:
ftp -n $HOST <<END_SCRIPT
user $USER $PASSWD
cd $webroot
put $backupname
quit
END_SCRIPT