Sponsored Content
Top Forums Shell Programming and Scripting Problem running zip from cron - bad zipfile offset Post 302937045 by Agreppa on Monday 2nd of March 2015 11:23:42 PM
Old 03-03-2015
Yes, the script runs perfectly. All the variables are defined at the top of the script. (I did mention that I was removing everything but the command itself to make the post shorter).

Everything runs.. the initial mysqldump.. the rsync.. the deletion of backups older than 2 weeks.. the zipping of everything into 2GB chunks.. the copying of the 2GB chunks to external USB.

The only thing I'm concerned with here is why the resulting 2GB zip chunks can't be unzipped without errors, and I think it's specifically something in the zip command in the last line of the last snippet I posted, but I can't figure out what it is.

Here is the relevant part of the script with variables:
Code:
#!/bin/bash

date=`/bin/date +%Y%m%d_%H%M%S`

dir=/mnt/data/Backups
dirlog=/mnt/data/Backups/logs
dircom=/mnt/data/Backups/website.com
dirdb=/mnt/data/Backups/website.db
dirzip=/mnt/data/Backups/website.zip
dirscript=/home/user/Scripts

source $HOME/.keychain/${HOSTNAME}-sh

# 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"
# Delete files older than X days
/usr/bin/find $dirdb/*sql.gz -mtime +14 -exec /bin/rm {} \;
/usr/bin/find $dirlog/*.log -mtime +30 -exec /bin/rm {} \;
/usr/bin/find $dirzip/*.z* -mtime +30 -exec /bin/rm {} \;
# Zip site to 2G chunks
/usr/bin/zip -r -s 2g -y -2 $dirzip/website_$date.zip $dircom/

Here's what happens:
The website has approx 120,000 files, including tens of thousands of pre-existing zipfiles in folders.
My script goes to the website and rsyncs everything, the entire hosting account, and brings it to my local computer.
(Those zipfiles on the website, once rsynced to my local machine, can be manually unzipped without any problem whatsoever, so the problem is not with the zipfiles on the site, nor with their rsynced copies on my local machine)
The next step in my script takes the entire rsynced website on my local machine and zips it into 2GB chunks.
As soon as those 2GB zip chunks are created, the 2GB zip chunks cannot be unzipped again without errors.
And not 100% errors. A large part of the site unzips properly. But it seems that the pre-existing zipfiles that were on the website are the files which cannot be extracted from the 2GB zip chunks. That's what I'm trying to figure out...

Last edited by Agreppa; 03-03-2015 at 12:44 AM..
 

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
zipsplit - split a zipfile into smaller zipfiles SYNOPSIS
zipsplit [-t] [-i] [-p] [-s] [-n size] [-r room] [-b path] [-h] [-v] [-L] zipfile ARGUMENTS
zipfile Zipfile to split. OPTIONS
-t Report how many files it will take, but don't make them. -i Make index (zipsplit.idx) and count its size against first zip file. -n size Make zip files no larger than "size" (default = 36000). -r room Leave room for "room" bytes on the first disk (default = 0). -b path Use path for the output zip files. -p Pause between output zip files. -s Do a sequential split even if it takes more zip files. -h Show a short help. -v Show version information. -L Show software license. DESCRIPTION
zipsplit reads a zipfile and splits it into smaller zipfiles. EXAMPLES
To be filled in. BUGS
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 10:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy