Quantcast
Channel: unable to extract file which is uploaded to FTP server - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 3

unable to extract file which is uploaded to FTP server

$
0
0

Source System:

  • CentOS 7
  • bash shell
  • zip

Destination System:

  • FTP server
  • CentOS 6.4
  • bash shell
  • unzip

I wrote a script to archive file and send it to FTP server using shell script

#!/bin/bash# Declare no. of daysdays=15# Declare Source path of sql files and Destination path of backup directorydumps=/home/applications/backupbkpdir=/home/applications/backup/olddumps# Find sql dumps of etsfiles=($(find $dumps/*.sql -mtime +"$days"))for file in ${files[*]}do# Move each file into backup dir which is 15 days oldecho "file is: $file\n";mv $file $bkpdir# Find the sql files and compress themcd $bkpdirfilename=$(basename $file)zip $bkpdir/$filename.zip $filename# FTP LoginHOST=a.b.c.dUSER=xxxxPASS=yyyyyREM_DIR=/olddumps/sqlfilesecho "Uploading file via FTP:"ftp -in $HOST <<EOFquote USER $USERquote PASS $PASScd $REM_DIRput $filename.zipbyeEOF# Remove sql files if anyrm $bkpdir/$filenamedone# Remove compressed files which are 6 months oldfind $bkpdir/*.zip -type f -mtime +180 -exec rm {} \;

Now the problem is the compressed file in destination system is not getting extracted using unzip command and shows the following error:

Archive: emt_bus-08-09-16-03-29.sql.zip

caution: zipfile comment truncatederror [emt_bus-08-09-16-03-29.sql.zip]: missing 49666528 bytes in zipfile(attempting to process anyway)error [emt_bus-08-09-16-03-29.sql.zip]: start of central directory not found;zipfile corrupt.(please check that you have transferred or created the zipfile in theappropriate BINARY mode and that you have compiled UnZip properly)

I used tar to archive, but no luck. It does not extract file in destination system and shows following error

gzip: stdin: invalid compressed data--format violatedemt_bus-08-09-16-03-29.sqltar: Unexpected EOF in archivetar: Unexpected EOF in archivetar: Error is not recoverable: exiting now

How to fix the issue?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>
<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596344.js" async> </script>