Sponsored Content
Full Discussion: An error with gzip
Top Forums Shell Programming and Scripting An error with gzip Post 92733 by Cameron on Wednesday 14th of December 2005 10:23:49 AM
Old 12-14-2005
An error with gzip

Have an issue with the following snippet of code, in particular the execution of the `gzip -9 ${ARCHIVE_FILE}`.
It is failing with a ReturnCode of 1 - Can anyone lead me to a souce that identifies & describes what RC's there are for gzip, as I've not been able to find any.

Code:
  echo '-- TARing up '${RUNTYPE}' files ...'

  tar -cVf  ${ARCHIVE_FILE} \
            ${File1}        \
            ${File2}
  TAR_RC=$?
  if [ ${TAR_RC} -ne 0 ] ; then

    echo ${0}' : ** ERROR w/- '${MKT}'('${RUNTYPE}') ARCHIVE file.'
    echo 'Error Code: '${TAR_RC}
    ##- Alert Notification -##
    EMAIL_WHO=${EMAIL_SUPPORT},${SMS_ALERT}
    EMAIL_SUB="${0} :  ** ERROR w/- ${MKT}(${RUNTYPE}) ARCHIVE file."
    EMAIL_BDY="An error has occurred with the creation of the ${MKT}(${RUNTYPE}) Archive file (${ARCHIVE_FILE}).\n\nPlease investigate and resolve accordingly.\n\nError Code: ${TAR_RC}"
    Alert_Email

  else

    ##- Continue with GZIP after successful TAR -##
    echo ''
    echo '-- GZIPing Archive(.tar) file ...'
    echo '-- TAR File: '${ARCHIVE_FILE}
    if [ -f ${ARCHIVE_FILE}.gz.old ] ; then
      mv ${ARCHIVE_FILE}.gz.old ${ARCHIVE_FILE}.gz.older
    fi
    if [ -f ${ARCHIVE_FILE}.gz ] ; then
      mv ${ARCHIVE_FILE}.gz ${ARCHIVE_FILE}.gz.old
    fi

    gzip -9 ${ARCHIVE_FILE}
    GZIP_RC=$?
    if [ ${GZIP_RC} -ne 0 ] ; then
      ##- Problem w/- GZIP -##
      echo ${0}' : ** ERROR w/- '${MKT}'('${RUNTYPE}') GZIP file.'
      echo 'Error Code: '${GZIP_RC}
      ##- Alert Notification -##
      EMAIL_WHO=${EMAIL_SUPPORT},${SMS_ALERT}
      EMAIL_SUB="${0} : ** ERROR w/- ${MKT}(${RUNTYPE}) GZIP file."
      EMAIL_BDY="An error has occurred with the creation of the ${MKT}(${RUNTYPE}) GZIP file (${ARCHIVE_FILE}.gz).\n\nPlease investigate and resolve accordingly.\n\nError Code: ${GZIP_RC}"
      Alert_Email
    fi

The `gzip` step executes as expected when performed manually.

Any assistance appreciated.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

using gzip

Hi, I am trying to unzip a file that I unmounted onto a unix machine from a cd I had burned in a Windows machine. The file I am trying to unzip is a .tar file... it was originally a .tar.gz file because it was zipped using gzip. I have tried: % gzip -d hpux.tar (where hpux.tar is the file... (2 Replies)
Discussion started by: nattie_h
2 Replies

2. Shell Programming and Scripting

Gzip help

Hi Experts!! I was creating a zip file in a server which had zip installed in it. I have another server in which zip is not there and i am instructed to make use of gzip to compress files. I would need your help to know the way to create a gzip file. 1) I do the following to create the zip... (5 Replies)
Discussion started by: ganga.dharan
5 Replies

3. AIX

GZIP ERROR! -- Plesae help! -- Urgent

I have two huge files on AIX Ver 5.0. File size of each file is 6238884375 bytes. There is huge difference in sizes when I zip them by gzip coomand. File1.gz 586147513 File2.gz 547585695 Any idea why it is so? Thanks Sumit (2 Replies)
Discussion started by: sumitc
2 Replies

4. UNIX for Dummies Questions & Answers

gunzip error - not in gzip format

Hi, I am getting this error gunzip file1.tar.Z gunzip: file1.tar.Z: not in gzip format Any clues? This goes bad only in some recent installations of ids (5 Replies)
Discussion started by: eagercyber
5 Replies

5. Shell Programming and Scripting

gzip

Hi, I want to gzip files in loop. for i in `ls *.xml`; do gzip $i; done But i am gettin error like "/usr/bin/ls: Arg list too long" Also please tell me how to do it with while loop and also using find and then exec. (7 Replies)
Discussion started by: tushar_tus
7 Replies

6. Programming

gzip on pipe error handling

Hi all... I have the following code: FILE *fp = popen(" gzip -dc /somemount/somefile.gz", "r"); while(fgets(buffer, 1024, fp)) { some code.... } "/somemount" is a mount of some network drive. Sometimes error occurs in while loop - I can see the following "Input/Output error"... (4 Replies)
Discussion started by: adm1n
4 Replies

7. UNIX for Advanced & Expert Users

gzip vs pipe gzip: produce different file size

Hi All, I have a random test file: test.txt, size: 146 $ ll test.txt $ 146 test.txt Take 1: $ cat test.txt | gzip > test.txt.gz $ ll test.txt.gz $ 124 test.txt.gz Take 2: $ gzip test.txt $ ll test.txt.gz $ 133 test.txt.gz As you can see, gzipping a file and piping into gzip... (1 Reply)
Discussion started by: hanfresco
1 Replies

8. Shell Programming and Scripting

Help with GZIP

Hi Gurus, I have a requirement to zip a file using gzip and ftp it to target server. I am using a gzip script as below. gzip.sh #!/bin/ksh /usr/bin/gzip -9 $1 Filename for gzip.sh is passed by an application program. so the output for ./gzip.sh Test_YYYYMMDDHHMMSS.txt (file name is... (1 Reply)
Discussion started by: PRVARMA
1 Replies

9. Shell Programming and Scripting

sh: gzip: not found ERROR

I am creating a script to run the SysInfo tool under HPUX servers, this is my script! #!/usr/bin/ksh # # Date: February 29th 2011 # #Definicion de variables PATH_TMP=/home/eponcede > HPUX_SysInfo.log for host in `cat $PATH_TMP/servers/host_hp2_test` do echo... (2 Replies)
Discussion started by: eponcedeleonc
2 Replies

10. Shell Programming and Scripting

gzip

how to zip all log file in a folder expect the latest gzip * ---> will zip all log files but I don't want the latest file to be zipped ex: file1, file2, file3, file4, file5 any single command to gzip all files excpet file5 ? (2 Replies)
Discussion started by: rmann
2 Replies
GZFORCE(1)						      General Commands Manual							GZFORCE(1)

NAME
gzforce - force a '.gz' extension on all gzip files SYNOPSIS
gzforce [ name ... ] DESCRIPTION
gzforce forces a .gz extension on all gzip files so that gzip will not compress them twice. This can be useful for files with names trun- cated after a file transfer. On systems with a 14 char limitation on file names, the original name is truncated to make room for the .gz suffix. For example, 12345678901234 is renamed to 12345678901.gz. A file name such as foo.tgz is left intact. SEE ALSO
gzip(1), gznew(1), gzmore(1), gzgrep(1), gzdiff(1), gzexe(1) ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +--------------------+-----------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +--------------------+-----------------+ |Availability | SUNWgzip | +--------------------+-----------------+ |Interface Stability | External | +--------------------+-----------------+ NOTES
Source for gzip is available in the SUNWgzipS package. GZFORCE(1)
All times are GMT -4. The time now is 03:44 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy