I want to upload backup archives from one server to another server using ftp. In my backup cronjob I use this script to upload files:
MEDIAFILE=/var/somedir/somefile.encrypted
if [ -r $MEDIAFILE ]
# File seems to exist and is readable
then
ftp -n $FTPHOST <<END_SCRIPT
quote USER $FTPUSER
quote PASS $FTPPASS
cd backups
put $MEDIAFILE
quit
END_SCRIPT
fi
This script returns:/var/somedir/somefile.encrypted: No such file or directory. But the file exists and the user executing the script has rights to read the file.
What is causing this error?
Best Answer
Alright, I should have done this to start with:
I added the remote filename to put, and the bin command - tested and works - hopefully it helps.
Edit: I should explain - the put command will assume that the remote path is the same as the local path if a remote path is not specified (second parameter) - so without the remote path, the file was not found on the remote server.