Need Assistance with gzipping files with same names


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Need Assistance with gzipping files with same names
# 1  
Old 01-27-2011
Need Assistance with gzipping files with same names

Hello,

I have an issue on a webserver where I have a perl script rotating and moving the logs to an archive directory where they are gzipped. This is working fine. The problem is when there is tracing enabled on my webserver where the tracelogs are rotated whenenver they reach 100Meg and they are given following filenames - tracelog.out.[1-9]. So the output would be simliar to following:

-rw-r--r-- 1 nobody group 5582894 Jan 6 20:46 tracelog.out.9.gz
-rw-r--r-- 1 nobody group 10538971 Jan 7 00:05 tracelog.out.9

Since there is a gzip file currently in same directory- I cannot gzip the tracelog.out.9 and thus diskspace is filling up.

I want to enhance my script to capture the tracelogs and rename them during the rolling cycle to a uniq name so the archive script will work every night.

Anyone know of quick way to do this?
# 2  
Old 01-27-2011
How are the .[0-9] filenames decided? We'll have to see your script to fix it of course.
# 3  
Old 02-04-2011
Thanks Corona 688..

What I am looking for is to build a script to only run when the tracelogging functionality is turned on the apache server. This functionality automatically rolls the trace.log once it reaches 100Meg in size. We did this on purpose so that vendors could easily read the files. So when the file reaches 100 Meg, it rolls it and renames the file to tracelog.1. This then go in sequencial order - we have had this run to almost the 200 range. I am looking for the right logic to do the following:

1. locate the trace.log.# and sort them by number
2. rename the trace.log# to unique file name structure in order to keep the archive file sequence intact.
3. gzip the new unique file name created.

Again this would be a secondary script only run when the trace functionality is enabled. If you could help with the logic I would be most greatful.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk assistance - Comparing 2 csv files

Hello all, I have searched high and low for a solution to this, many have come really close but not quite what I'm after. I have 2 files. One contains GUID's, for example: 8121E002-96FE-4C9C-BC5A-6AFF20DACECD 84468F30-F3B7-418B-81F0-0908E80792BF A second file, contains a path to the... (8 Replies)
Discussion started by: tirmUK
8 Replies

2. Shell Programming and Scripting

Exclude certain file names while selectingData files coming in different names in a file name called

Data files coming in different names in a file name called process.txt. 1. shipments_yyyymmdd.gz 2 Order_yyyymmdd.gz 3. Invoice_yyyymmdd.gz 4. globalorder_yyyymmdd.gz The process needs to discard all the below files and only process two of the 4 file names available ... (1 Reply)
Discussion started by: dsravanam
1 Replies

3. Shell Programming and Scripting

Assistance with an awk code to split files but keep the header

---------- Post updated at 11:48 AM ---------- Previous update was at 11:46 AM ---------- Hello all I have an awk code that successfully creates separate text files based on the first six letters of the second field. What it doesn't do is preserve the header into each resulting file. ... (6 Replies)
Discussion started by: colecandoo
6 Replies

4. Shell Programming and Scripting

Assistance for sorting files

Hi there, I have tried using the "find" command to do this but to no avail as the "find -mtime" command I used descend to the directories from my current working directory. Say in "directoryA" has multiple files and those files are created on a daily basis. Under "directoryB", there are... (4 Replies)
Discussion started by: chewku
4 Replies

5. UNIX for Dummies Questions & Answers

Assistance with combining, sorting and saving multi files into one new file

Good morning. I have a piece of code that is currently taking multiple files and using the CAT.exe command to combine into one file that is then sorted in reverse order based on the 3rd field of the file, then displayed on screen. I am trying to change this so that the files are being combined into... (4 Replies)
Discussion started by: jaacmmason
4 Replies

6. Shell Programming and Scripting

Assistance with regex and config files

I am trying to write a shell script that will such in data from a config file. The script should mount device nodes that are contained in a config file in the following format: # filesystem type # read/write #device # Mount Point xfs w ... (1 Reply)
Discussion started by: pryker
1 Replies

7. Shell Programming and Scripting

cd to multiple directories and gzipping files within

I am working on a Korn shell script that will cd into multiple directories that are listed in a flat file and gzip the contents of each directory. So far, this is what I have: 1) Find the 4 largest directories and place them into the file foo du -sk /some/directory/* | sort -rn | head -4... (0 Replies)
Discussion started by: sunsysadm2003
0 Replies

8. UNIX for Dummies Questions & Answers

gzipping large (2+ gb) files.

Is it possible? I am trying to do it with gzip 1.2.4 and it comes back saying the file type is too large. Any way to compress massive things? (2 Replies)
Discussion started by: LordJezo
2 Replies

9. Windows & DOS: Issues & Discussions

Urgent Need for Assistance: Triggering Windows bat files from UNIX

Hello, Is there a way to trigger a Windows bat file or program on a different machine from a different UNIX server using KSC file? I hope you can assist me with this. Thanks! (0 Replies)
Discussion started by: punyenye
0 Replies

10. UNIX for Dummies Questions & Answers

tarring and gzipping dump files

Say I want to transfer several dump files from a Solaris machine onto a Win2k machine for storage. It was suggested that I tar and gzip the dump files before doing so. Is it completely necessary to use both of these utilities, or is it sufficient to compress multiple dump files into one gzip... (4 Replies)
Discussion started by: PSC
4 Replies
Login or Register to Ask a Question