The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Reg: Gzip sam99 Shell Programming and Scripting 5 01-30-2008 07:43 AM
tar/gzip/gz...which one to use? abhijeetkul UNIX for Advanced & Expert Users 5 03-24-2006 03:00 AM
TAR and GZIP help VandeMatram UNIX for Dummies Questions & Answers 3 03-17-2006 07:35 AM
gzip alisevA3 UNIX for Dummies Questions & Answers 2 08-12-2004 11:29 AM
gzip mfran2002 SCO 1 12-01-2003 10:23 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 06-21-2007
tungaw2004 tungaw2004 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 31
tar and gzip

Hi,

I would like to have a combined gzip and tar that will compress and create multiple output tar.gz files. I want to have multiple files output because i cannot create an archive because there is no more space on my harddisk. I cannot transfer it locally because of slow connection. I want to have a script that once it reached the maximum limit (e.g.100MB), it will prompt me to create a new file.

Anyone can help?

thanks,

btw, i already did this

$tar cvf - filename.xxx |gzip > filename.tar.gz
  #2 (permalink)  
Old 06-22-2007
kamitsin's Avatar
kamitsin kamitsin is offline
Registered User
  
 

Join Date: Nov 2006
Location: /dev/null
Posts: 177
Quote:
I would like to have a combined gzip and tar that will compress and create multiple output tar.gz files. I want to have multiple files output because i cannot create an archive because there is no more space on my harddisk.
What do you mean by multiple file output? Do you want multiple tar.gz files ?

Code:
I cannot transfer it locally because of slow connection. I want to have a script that once it reached the maximum limit (e.g.100MB), it will prompt me to create a new file.
Do you want to create a new tar.gz file once the current tar.gz file has reached the size of 100MB?

Please answer my queries and may be i can help.
  #3 (permalink)  
Old 06-22-2007
tungaw2004 tungaw2004 is offline
Registered User
  
 

Join Date: Feb 2007
Posts: 31
Tar and gzip

Here is the scenario:

1. I have a 5.7 GB log which i want to archive. However, my problem is the hdisk has no more space available.

Solution i want to have :

a. create a backup of the file through tar/gzip command but will have a limit of 100MB/file or depending on the maximum limit i will set. It will prompt me that it reached the limit. From there, i can transfer the first file to my local machine and continue creating the next file gz.
  #4 (permalink)  
Old 06-22-2007
kamitsin's Avatar
kamitsin kamitsin is offline
Registered User
  
 

Join Date: Nov 2006
Location: /dev/null
Posts: 177
#!/bin/ksh

LOGDIR=/home/XXXX
ARCHIVE_NAME=/tmp/archive.tar
MAX_ARCHIVE_SIZE=XXX # your choice

tar -cvf ${ARCHIVE_NAME}

for FILENAME in `ls -lrt ${LOGDIR}|awk '{print $9}'`
do
gzip ${FILENAME} 2>/dev/null
tar -rvf ${ARCHIVE_NAME} ${FILENAME}.gz 2>/dev/null
rm -f ${FILENAME}.gz 2>/dev/null
SIZE=`ls -l ${ARCHIVE_NAME} | awk '{print $5}'`
if [[ "${SIZE}" >= "${MAX_ARCHIVE_SIZE}" ]]
then
move_delete_file; # function to move and delete the archive from LOGDIR
fi
done

Last edited by kamitsin; 06-23-2007 at 04:11 AM..
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 07:35 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0