TAR size difference after uploading to Linux server via FTP command or a shell script with FTP command -


i have tar file "backup_20140626" size 444477440. uploaded via ftp onto nas running linux so:

>put backup_20140626 local: backup_20140626 remote: backup_20140626 229 entering extended passive mode (|||22735|) 150 opening binary mode data connection backup_20140626 100% |*************************************|   423 mb   26.59 mb/s    00:00 eta 226 transfer complete 444477440 bytes sent in 00:15 (26.57 mb/s) 

i downloaded file , opened.

then wrote script backup.sh auotmate uploading:

ftp -n 192.168.0.2 <<eof quote user backup quote pass backup cd /mnt/array1/_backup put backup_20140626  quit eof 

ok, ran script:

#./backup.sh connected 192.168.0.2. 220 192.168.0.2 ftp server ready 331 password required backup 230 user backup logged in 250 cwd command successful local directory /backup/dat local: backup_20140626 remote: backup_20140626 229 entering extended passive mode (|||63859|) 150 opening binary mode data connection backup_20140626 100% |*************************************|   425 mb   21.42 mb/s    --:-- eta 226 transfer complete 446076565 bytes sent in 00:19 (21.42 mb/s) 221 goodbye. 

the transferred sizes of same file different! downloadeded file again , cannot recognized tar file:

#tar xvf backup_20140626 tar: not tar archive tar: skipping next header tar: exiting failure status due previous errors 

could tell me what's wrong here? thank much!

if run dos2unix on tar file, fix file size? if so, it's because transferred ascii (not binary) regardless of program said.

you can specify 'binary' in script, , if didn't want rewrite script every time, let read file name argument:

ftp -n 192.168.0.2 <<eof quote user backup quote pass backup binary cd /mnt/array1/_backup put backup_20140626 quit eof 

off topic, if didn't want rewrite script every time, have read argument command line ./ftpscript.sh backup_20140626 (or whatever file named day).

ftp -n 192.168.0.2 <<eof quote user backup quote pass backup binary cd /mnt/array1/_backup put $1 quit eof 

Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -