![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Truncate multiple file extensions | prvnrk | Shell Programming and Scripting | 12 | 04-04-2008 10:20 AM |
| Truncate last <n> characters from a file | Gwailo88 | UNIX for Dummies Questions & Answers | 1 | 03-05-2008 12:52 AM |
| Truncate File contain | rinku | Shell Programming and Scripting | 2 | 05-30-2007 06:43 AM |
| how to truncate a large (8 GB) file | kotasateesh | Shell Programming and Scripting | 1 | 07-05-2006 01:57 AM |
| Truncate what is It? | rocker40 | UNIX for Dummies Questions & Answers | 2 | 10-11-2003 07:40 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
truncate file script is not working
Hi All,
I have an application which writes log in to a file. The file size becomes around min of 800 MB a day. So I have written a script which backup the file and truncate the original file. My script is like this cp X.log /backup/X.log1 > X.log But the second truncate command is not working properly.The file is truncated to 0 byte but whenever the application writes the next log the file size is coming to the previous original size. Can anyone please guide how to truncate the file properly. Thanks in Advance Venkat |
|
||||
|
Hi,
Your doubt is right. The application was opening the log file in the WRITE mode but not in APPEND mode. That is why even if I truncate the file, the application doesnt know about the change in the offset of the log file. So the application was writing the log after the next offset what it was previously but not from the starting. I have changed the configurations so that the application opens the log file in APPEND mode and it is working now. Thanks all. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|