Operating System - HP-UX
1748275 Members
3681 Online
108761 Solutions
New Discussion

How to delete a log file on HP-UX 11.23/11.31

 
sksonkar
Contributor

How to delete a log file on HP-UX 11.23/11.31

Hello,

 

How to delete a log file if it is currently being written by a process or application on HP-UX ?

 

Thanks,

Shiv

2 REPLIES 2
adr33
Occasional Advisor

Re: How to delete a log file on HP-UX 11.23/11.31

do you mean the syntax? you can use rm [log name]
or rm * to remove all logs file. But you must know first where the location of the log.
Dennis Handly
Acclaimed Contributor

Re: How to delete a log file on HP-UX 11.23/11.31

>How to delete a log file if it is currently being written by a process?

 

You have a problem.  You have to know how the process is accessing the log.  If it keeps the file open, if you remove it, the file will still grow but only lsof will see it.

If it opens and closes the file each time, you remove it and it may be recreated.

If you try to reset the EOF to 0, the application may continue to write to what it thinks is the old EOF, so you may nuke the contents up to that EOF.

Or it may just start writing at the beginning.