我想尝试将自己的自动匹配mysql备份到我的ftp服务器,但是当我尝试这样做时。它不想将它发送到我的服务器,但如果我手动执行它就可以了
open xxxx
user $xxx $xx
cd $xxx
put $xxx
close
bye
bash脚本
#!/bin/bash
user=zzzzzzzz
password=zzzzzzzz
host=localhost
db_name=zzzzzzzz
#backup_path="/var/www/html/storelte/database"
date=$(date +"%d-%b-%Y")
file=$db_name-$date.sql
############### Local Backup ########################
mysqldump --routines --user=$user --password=$password --host=$host $db_name > $file
gzip -9 $file
############### FTP details #########################
FTP_SERVER=xxxxxx
FTP_USERNAME="xxxxxx"
FTP_PASSWORD="xxxxxx"
FTP_UPLOAD_DIR="/database"
FTP_FILE = $db_name-$date.sql.gz
#ftp -inv $FTP_SERVER << EOF
#user $FTP_USERNAME $FTP_PASSWORD
#cd $FTP_UPLOAD_DIR
#put $file_name
#close
#bye
#EOF
ftp -inv << EOF
open $FTP_SERVER
user $FTP_USERNAME $FTP_PASSWORD
cd $FTP_UPLOAD_DIR
put $FTP_FILE
close
bye
EOF
输出
<p>./database.sh: line 18: FTP_FILE: command not found
Connected to xxx.xxx.xxxx.xxxx.
220 (vsFTPd 3.0.3)
331 Please specify the password.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
250 Directory successfully changed.
(local-file) (remote-file) local: close remote: bye
local: close: No such file or directory
221 Goodbye.</p>
请帮忙。