Sponsored Content
Top Forums Shell Programming and Scripting Facing issues with tar and gzip ! Post 302668795 by acidburn_007 on Tuesday 10th of July 2012 03:38:20 AM
Old 07-10-2012
Hi Zedex,

Thanks for the post !

I tried using :-


Code:
 
tar -tvf <tar_file>


After executing it. All the list of the backup log files were displayed. The size of the file doesn't got reduced. Like before it is again doing the tar and gzip operation on the already done files and because of that the size of the backup file is increasing !!!

---------- Post updated at 01:08 PM ---------- Previous update was at 12:39 PM ----------

Hi,
Please let me explain my requirement and the bottleneck!
My Requirement:-
In our main file BLUESTAR_Archieve.log the logs gets appended every day.
So, we are required to take the back-up of the log files daily based on timestamp.
For this I have written a script :-
Code:
 
#!/bin/ksh
# A shell script ------------------------------------------------------------------
cd /app/local/XXX/XXX/XXX/logs
 
find BLUESTAR_Archieve.log -exec cp {} BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M) \;
 
tar –cvf BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M).tar /app/local/XXX/XXX/XXX/logs
 
gzip /app/local/XXX/XXX/XXX/logs/ BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M) 
 
mv BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M) .tar.gz /app/local/XXX/XXX/XXX/logs /LogsBackup
 
rm –f /app/local/XXX/XXX/XXX/logs / BLUESTAR_Archieve.log _$(date +%y_%m_%d_%H_%M)
 
cat /dev/null > BLUESTAR_Archieve.log

Problem :-
The script is running fine.
But when I checked the back-up log files. The size of the files are increasing :-
HTML Code:
-rw-r--r-- 1734571 Jul 9 10:03 BLUESTAR_Archive.log.log_12_07_10_10_03.tar.gz
-rw-r--r-- 3318456 Jul 9 10:10 BLUESTAR_Archive.log.log_12_07_10_10_10.tar.gz
-rw-r--r-- 12031131 Jul 9 10:15 BLUESTAR_Archive.log.log_12_07_10_10_15.tar.gz
-rw-r--r-- 41523045 Jul 9 10:26 BLUESTAR_Archive.log.log_12_07_10_10_26.tar.gz
-rw-r--r-- 66620915 Jul 9 10:38 BLUESTAR_Archive.log.log_12_07_10_10_38.tar.gz
 

After getting the post from fellow members. I came to realize that the tar and gzip are performing the action on the files on which this action had already been performed.
I tried the below command also :-
Code:
Tar –tvf <tar_file >



But this is displaying all the files in the BackupLogs !!!

Is there any way around. So, that the tar and gzip don’t perform the same operations on the already performed files.
I don't need the tar and gzip to perform the same action on the already done files. Instead it should be doing the tar and gzip action only on new files !
Please suggest/ help !

Thanks

Last edited by acidburn_007; 07-10-2012 at 04:43 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

can i tar and gzip in one liner ?

hello can i combine this 2 commands in one liner command? (1 Reply)
Discussion started by: umen
1 Replies

2. UNIX for Dummies Questions & Answers

TAR and GZIP help

Hi, There are 700 .pdf files in a certain directory on the server and I need to TAR them first and then compress them using GZIP to free up the space. The combined size of the .pdf files is 3gb. However, there is only 1gb of free space on the server. So as you can see when I try to TAR these... (3 Replies)
Discussion started by: VandeMatram
3 Replies

3. UNIX for Advanced & Expert Users

tar/gzip/gz...which one to use?

P0251WLADC.svm_wl1 > /svm_wl1/billing/data/server/archive/ALLEVT $ du -k FEB2006 22050224 FEB2006 As you can see,i have a folder called "FEB2006" which is around 22 GB. i guess zip or compress wont work...( i don know how do we compress a folder) i wished to use ""tar" ( i suppose... (5 Replies)
Discussion started by: abhijeetkul
5 Replies

4. UNIX for Dummies Questions & Answers

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... (3 Replies)
Discussion started by: tungaw2004
3 Replies

5. UNIX for Advanced & Expert Users

tar and gzip extraction issues

Not sure if this is really in the right forum but here goes.... Looking for a way to extract individual compressed files from a compressed tarball WITHOUT tar -zxvf and then recompressing. Basically we need to be able to chunk out an individual compressed file while it still remains... (6 Replies)
Discussion started by: athos
6 Replies

6. UNIX for Dummies Questions & Answers

Facing issues while running a cronjob !

Hi, I am trying to run a cronjob. But while doing so I am getting the following error message :- can't open yourfile in /var/spool/cron/crontabs directory. No such file or directory How can I resolve this issue ? Please help. Thanks Please view this code tag video for... (14 Replies)
Discussion started by: acidburn_007
14 Replies

7. Shell Programming and Scripting

Facing issues with cronjobs

Hello Everyone, We have a cronjob scheduled to pick up files from one system and transfer to another system. the underlying code is a shell script. These cronjobs were working correctly until sometime. 2 days back they did not pick up the scripts but created empty logs. However when we tried... (6 Replies)
Discussion started by: Rads
6 Replies

8. Post Here to Contact Site Administrators and Moderators

Regarding facing issues while accessing UNIX.com site

Hello Moderators/Admins, This is regarding an issue which I am facing from last 7 to 8 days. Issue is while trying to access this forum(simple hitting http://unix.com) I am able to login but many times my request gets timed out or 404 error or if I am able to login it will be excessive slow even... (0 Replies)
Discussion started by: RavinderSingh13
0 Replies

9. Shell Programming and Scripting

Facing issues with rsync

Hello Gurus, I am running rsync command to copy certain Directories and files into that directories to remote server. While ruuning the command all teh files has been copied but I am facing error. The below command I am executing to copy Directories and files to remote server: rsync -avrz ssh... (3 Replies)
Discussion started by: pokhraj_d
3 Replies

10. Shell Programming and Scripting

Facing issues with shell script changes

My current requirement is to replace xxyxx string with value of date date1 variable holds a date and the current script writes html tags to a file as follows echo date1 nawk 'BEGIN{ FS="," print "<HTML>""<HEAD>""<p>Hi All,<br><br>There are no cases closed on the xxyxx" print ... (2 Replies)
Discussion started by: Rajesh A S
2 Replies
All times are GMT -4. The time now is 07:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy