Sponsored Content
Top Forums Shell Programming and Scripting Problem running zip from cron - bad zipfile offset Post 302937041 by Agreppa on Monday 2nd of March 2015 07:02:56 PM
Old 03-02-2015
Problem running zip from cron - bad zipfile offset

I've created a pretty straightforward shell script to do backups via rsync. Every night it rsyncs a copy of a website (approx 60GB) to the local machine. Once a week, after the rsync step, it zips the local copy of the whole site into 2GB chunks and places them in another folder.

When running 'unzip filename.zip' I get a long string of errors similar to this:

Code:
file #17934:  bad zipfile offset (lseek):  1726201856
file #17935:  bad zipfile offset (lseek):  1726775296
file #17936:  bad zipfile offset (local header sig):  1702568762
file #17937:  bad zipfile offset (EOF):  1545311941

Approx 60% of the archived series of 2GB chunks unzips without any problem, but the rest shows those errors above. Those errors "seem" to be happening on files that were already .zip files on the webserver, and which were originally created with a mix of windows WinRAR and command line windows 'zip'. (I don't see how the original method of creation would impact them being zipped into a larger archive, but I'm mentioning it to be thorough).

ALSO: If I ftp the entire linux-created series of 2GB chunks to a Windows machine and open them in WinRAR, they all extract without any problem.

Here's the crontab I'm using:
Code:
2 * * 2-7 /home/user/Scripts/backup.rsync.sh > /mnt/data/Backups/logs/$(date +\%Y\%m\%d_\%H\%M\%S)_website.rsync.cron.log 2>&1
0 2 * * 1 /home/user/Scripts/backup.full.sh > /mnt/data/Backups/logs/$(date +\%Y\%m\%d_\%H\%M\%S)_website.full.cron.log 2>&1

And here are the 2 scripts referenced in that same cron with a lot of additional commands removed for clarity:

backup.rsync.sh
Code:
# Rsync website.com to local machine
/usr/bin/rsync -Pavzhe "ssh -p 22" --log-file=$dirlog/$date\_website.rsync.log --bwlimit=2500 --skip-compress=jpg/zip --delete user@website.com:'/home/user/' "/mnt/data/Backups/website.com"

backup.full.sh
Code:
# Rsync website.com to local machine
/usr/bin/rsync -Pavzhe "ssh -p 22" --log-file=$dirlog/$date\_website.rsync.log --bwlimit=2500 --skip-compress=jpg/zip --delete user@website.com:'/home/user/' "/mnt/data/Backups/website.com"
# Zip site to 2G chunks
/usr/bin/zip -r -s 2g -y -2 $dirzip/website_$date.zip $dircom/

Something in that final zip command seems to be the cause but I can't figure it out. The fact that I can take those resulting files into windows and extract them with winRAR is even more confusing, since linux 'unzip' throws thousands of errors... Can anyone suggest what's wrong with my batch script?

PS: The 'zip' version is 3.0-6 and 'unzip' is 6.0-8+deb7u2. The local machine is Crunchbang 11.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to find files within a zipfile on AIX5.3

In a directory I have several zipfiles, every zip files has some csv files within. I need to find out which zipfiles have the particular csv files. I know we can use a zipgrep on linux. Does AIX have a similar command. Any help appreciated. Thanks & Regards, Ram (1 Reply)
Discussion started by: ramky79
1 Replies

2. Shell Programming and Scripting

Behavior of Bad Script in Cron Job

Hi A Ksh script is deployed in a server and executed through cronjob. If one of the line in the middle of the script fails . Are the remaining lines executed ? (3 Replies)
Discussion started by: Sivaswami
3 Replies

3. UNIX for Dummies Questions & Answers

Problem running a cron job

I have created a cron job for the vtiger workflow to execute the shell file named com_vtiger_workflow.sh to run the workflow. I've created the following line in crotab -e : 00 13 * * * /var/www/html/prashant/cron/modules/com_vtiger_workflow/com_vtiger_tiger_workflow.sh | mail -s 'Check... (2 Replies)
Discussion started by: anaigini45
2 Replies

4. Shell Programming and Scripting

Cron job running problem

Hi Guys, I am trying to run a script through contab. The script can only be executed once user logs in as su - oracle. I have tested the script other then cronjob and it executes successfully, more over the paths used in the script are absolute paths. Crontab entries are as as below.... (3 Replies)
Discussion started by: Asteroid
3 Replies

5. AIX

Partition offset problem after re-mirror vg

We had a mirrored disk failed (not the rootvg), there are 3 lvs (transfer, applogs, arch) from extvg gone open/stale state. After replaced failed disk and run cfgmgr, the new replaced disk is visible: ) I did the following to re-mirror new disk: # extendvg prodvg hdisk3 # lspv (got new pvid on... (2 Replies)
Discussion started by: jalite19
2 Replies

6. Shell Programming and Scripting

bad interpreter when running script

Hi All, I'm not confortable in writing script, can someone can help me, when I run that script below i found this error code : -bash: ./script.sh: /bin/sh.: bad interpreter: Here is the script for i in * x=${i##*.} z=$(perl -e 'print time;') t=$(echo $z-$x|bc)... (12 Replies)
Discussion started by: bzb23
12 Replies

7. Solaris

! bad user (adm).. in cron log

I have noticed this error in /var/cron/log: > CMD: /usr/lib/acct/ckpacct > adm 6739 c Tue Oct 11 10:00:00 2011 < adm 6739 c Tue Oct 11 10:00:00 2011 rc=1 ! bad user (adm) Tue Oct 11 11:00:00 2011but when I try to list crontab of user 'adm': solarni/~# crontab -l adm crontab: you are... (4 Replies)
Discussion started by: orange47
4 Replies

8. UNIX for Advanced & Expert Users

Running multiple php scripts into one php only, cron mail alert problem...

hi, while separated they produce the usual mail alert and i can see the output... if i write into the php script: <?php system('php -f /var/www/vhosts/domain.com/httpdocs/folder/script1.php'); system('php -f /var/www/vhosts/domain.com/httpdocs/folder/script2.php'); system('php -f... (0 Replies)
Discussion started by: 7stars
0 Replies

9. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

10. UNIX for Advanced & Expert Users

Grep --byte-offset not returning the offset (Grep version 2.5.1)

Hi, I am trying to get the position of a repeated string in a line using grep -b -o "pattern" In my server I am using GNU grep version 2.14 and the code is working fine. However when I am deploying the same code in a different server which is using GNU grep version 2.5.1 the code is not... (3 Replies)
Discussion started by: Subhamoy
3 Replies
zipnote(1)						      General Commands Manual							zipnote(1)

NAME
zipnote - write the comments in zipfile to stdout, edit comments and rename files in zipfile SYNOPSIS
zipnote [-w] [-b path] [-h] [-v] [-L] zipfile ARGUMENTS
zipfile Zipfile to read comments from or edit. OPTIONS
-w Write comments to a zipfile from stdin (see below). -b path Use path for the temporary zip file. -h Show a short help. -v Show version information. -L Show software license. DESCRIPTION
zipnote writes the comments in a zipfile to stdout. This is the default mode. A second mode allows updating the comments in a zipfile as well as allows changing the names of the files in the zipfile. These modes are described below. EXAMPLES
To write all comments in a zipfile to stdout use for example zipnote foo.zip > foo.tmp This writes all comments in the zipfile foo.zip to the file foo.tmp in a specific format. If desired, this file can then be edited to change the comments and then used to update the zipfile. zipnote -w foo.zip < foo.tmp The names of the files in the zipfile can also be changed in this way. This is done by following lines like "@ name" in the created temporary file (called foo.tmp here) with lines like "@=newname" and then using the -w option as above. BUGS
The temporary file format is rather specific and zipnote is rather picky about it. It should be easier to change file names in a script. Does not yet support large (> 2 GB) or split archives. SEE ALSO
zip(1), unzip(1) AUTHOR
Info-ZIP v3.0 of 8 May 2008 zipnote(1)
All times are GMT -4. The time now is 03:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy