我想使用 ftp 将备份档案从一台服务器上传到另一台服务器。在我的备份 cronjob 中,我使用此脚本上传文件:
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
Run Code Online (Sandbox Code Playgroud)
此脚本返回:/var/somedir/somefile.encrypted: No such file or directory。但是该文件存在并且执行脚本的用户有权读取该文件。
是什么导致了这个错误?