Reputation: 3
I'm currently making some scripts, for my Centos 7 server, just to ease the process of having a server. I wrote this simple script, but it cant find the files or something like that....
#!/bin/bash
TIME=`date +%b-%d-%y` # This Command will add date in Backup File Name.
FILENAME=backup-$TIME.tar.gz # Here i define Backup file name format.
SRCDIR=/imp-data # Location of Important Data Directory (Source of backup).
DESDIR=/backups # Destination of backup file.
tar -cpzf $DESDIR/$FILENAME $SRCDIR
HOST=34.77.147.135 # 2
USER=backupuser # 3
PASSWORD=backup # 4
ftp -inv $HOST <<EOF # 5
user $USER $PASSWORD # 6
lcd /backups # 7
mput *.tar.gz # 8
bye # 9
EOF
#END
I expect the files getting uploaded to the given FTP server. But i'm getting this response:
local: # remote: #
local: #: No such file or directory
local: 8 remote: 8
local: 8: No such file or directory
221 Goodbye
Upvotes: 0
Views: 46
Reputation: 85907
ftp -inv $HOST <<EOF # 5
user $USER $PASSWORD # 6
lcd /backups # 7
mput *.tar.gz # 8
bye # 9
EOF
Those "comments" aren't comments, they're part of the here-document started by <<EOF
. For example, you're executing the command
mput *.tar.gz # 8
which fails because there are no files named #
or 8
.
Upvotes: 3