How To Rotate A File in HP-UX?

Thread Tools Search this Thread
Operating Systems HP-UX How To Rotate A File in HP-UX?
# 8  
Old 10-30-2013
Im missing somthing here, you nulled your file and it wrote in it after, so it works!
But maybe that isnt what you wanted... What is it we are not getting? You should try to describe more your issue, here it seems unclear what isnt giving you satisfaction ( what has size got to do?)
I use this methis for sensible logs in /var/adm... but your extension makes me doubt terribly on the usage
# 9  
Old 10-30-2013
Ok, i will try to explain better!, Smilie

Yeah, the application writes it, but the size of the file does not decrement. This file has 8GB in Production right now (2 months) and i want to rotate it each 100Mb. With your solution, we have a backup each day (for example) of 100Mb. Yeah, itīs fine...but the original file keeps the size :s....100MB first day...200MB second day...It have 0MB at the moment of i nulled...but at the next time application writes it....the size return to be the original size.
# 10  
Old 10-30-2013
logrotate implements what vbe is describing using the 'copytruncate' option in the configuration file.

Alternatively, I have used the mv command to rename the logfile, after which the app continues writing to the renamed file, until I 'kill -1 PID' the process id of the parent application process, which causes it to close the log and start writing a new one
# 11  
Old 10-30-2013
@nzle: Ive explained in post#4 the move issue and workaround if you cannot stop the process writing to it...
We were thinking your file was a log, if it isnt the case, things can be far more tricky, for we dont know the content...
Depending what its possible you have no other choice but to stop and create a new one...
So what applicationis this and what is the file for?
# 12  
Old 10-30-2013
The extension is not very intuitive Smilie. Itīs a application log, nothing strange. But i cannot stop the process writing...
# 13  
Old 10-30-2013
Well yes there is something strange for a log is a continuous output from a process which doesnt normally look back at what it already has written like it seems to be the case with your file

What is in the file? what is tis format? ( So we can try to figure out something...)
# 14  
Old 10-30-2013
Itīs text plain. It contains the output of a continuos activation in network elements
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Logs do not rotate

My problem: Both access and error logs do not rotate any more and get really large. They are located here: /srv/www/+vHost name here+/logs/ Configuration seems to be here: /etc/logrotate.conf => looks OK, including "size 10M" to avoid large files (/etc/logrotate.d => is empty) manually... (4 Replies)
Discussion started by: floko
4 Replies

2. Shell Programming and Scripting

Log rotate

Hi, I have below script in logrotate.d to rotate logs. logs are not rotating after the file grow to 1k, do you have any idea? Is it because of it just only 1K? Please let me know if the below syntax is in correct. # more trotate /sourcepath/*/servers/*/logs/*log... (2 Replies)
Discussion started by: lpprasad321
2 Replies

3. Shell Programming and Scripting

Script to rotate file log

Hi Experts, I have script on crontab and give output quite large. I would like to know how to create rotate log when the size of log maximum 50MB if the test.log is 50MB then create test.0 Thanks Edy (2 Replies)
Discussion started by: edydsuranta
2 Replies

4. Shell Programming and Scripting

Help with a rotate log script

Hi all, Am trying to write my own log rotate script. Curremtly, what I have is as below: #!/bin/ksh file_to_rotate=${1} x=${2} while ] do let curr=${x} let prev=${x}-1 if ] ; then #echo "cp -p ${file_to_rotate} ${file_to_rotate}.${curr}" cp -p... (7 Replies)
Discussion started by: newbie_01
7 Replies

5. UNIX for Dummies Questions & Answers

Rotate logs every 1 hour

Hello All, I am learning unix and basically I want to rotate one of my application logs every 1 hour. I need to rotate that file every one hour. I looked in the forums and googled.. but couldn;t get proper information. Requesting you all to kindly guide me. Our application is running on... (4 Replies)
Discussion started by: arunpvp
4 Replies

6. Programming

Rotate an array

i have an array a={1,2,3,4,5} the output should be a= {4,5,1,2,3} please help me writin this program in c. (10 Replies)
Discussion started by: pgmfourms
10 Replies

7. Shell Programming and Scripting

Script for Log Rotate

Hello, I only know the basic for shell programing. I need help for this, I thinks this is a basic for anyone who know a litle of shell scripting. I need creat a script for a rotatate logs, when a filesystem is full. I have a filesystem. The rotate consist in zip the current log (copy) and... (1 Reply)
Discussion started by: El Rengo
1 Replies

8. UNIX for Advanced & Expert Users

log rotate

hi , what is the meaning of log rotate? how do i rotate /var/adm/wtmps log and gzip it? (6 Replies)
Discussion started by: cromohawk
6 Replies

9. Shell Programming and Scripting

Help with script, trying to get tcpdump and rotate the file every 300 seconds

Greetings, I just started using scripting languages, im trying to get a tcpdump in a file, change the file name every 5mins ... this is what i have but its not working ... any suggestions? #!/bin/bash # #timestamp format TIMESTAMP=`date -u "+%Y%m%dT%H%M%S"` #tdump =`tcpdump... (3 Replies)
Discussion started by: livewire
3 Replies

10. Shell Programming and Scripting

how to rotate log files

hi friends i need a shell script to rotate the logs in a directory, dated n days back. can anybody of help. appreciate.. (0 Replies)
Discussion started by: satya_skm
0 Replies
Login or Register to Ask a Question