ftp - Wait until zip fully written then continue, Bash Script -
i've been trying zip file , upload ftp using bash script, it's uploading corrupt zip file. i've had around , i'm trying use lsof | grep confirm file complete i'm not sure i'm doing.
so i've got
cd /var/test/tobezipped zip -r test.zip * folder="/var/test/tobezipped" zips=$(ls $folder) f in $zips ; while [ -n "$(lsof | grep $f" ] ; sleep 1 done ftp -n <<eof open myserver user user pass put test.zip eof done
and test.zip corrupt @ time it's being uploaded, on other server it's not readable on server it's zipped on it's time check it.
any kind of advice appreciated, i'm pretty new sort of thing , tried search around heaps find solution, not sure i'm going in right direction. in advance.
from man page:
put local-file [remote-file] store local file on remote machine. if remote-file left unspecified, local file name used after processing according ntrans or nmap settings in naming remote file. file transfer uses current settings type, format, mode, , structure.
i guess problem not transfering files in binary mode.
try this:
ftp -n <<eof open myserver user user pass binary put test.zip eof
Comments
Post a Comment