So, i'm trying to get an ftp script working but i'm hitting a snag. Here's the script:
#!/bin/bash
HOST='192.168.178.122'
USER='ftpuser'
PASSWD='passa.2015'
DATE=`date +%d-%m-%Y`
FILE="archive-"$DATE".tar.gz"
prep=0
echo "File is="$FILE
echo "Prepare_val="$prep
if [ $prep -eq 0 ]
then
find Web -maxdepth 1 -mindepth 1 -not -type l -print0 | tar --null --files-from - -cpzvf $FILE
ftp -n $HOST << EOT
user $USER $PASSWD
put $FILE
quit
bye
EOT
fi
When i try and run this script, it returns the following error:
ftp-script.sh: 22: ftp-script.sh: Syntax error: end of file unexpected (expecting "fi")
If i remove the EOT section, it executes fine, but the EOT is the only means by which the ftp commands can be run without needing user intervention. Does anyone know how to place an EOT in a conditional without causing the error I get.