Situation  file_to_be_truncated is a debug or monitor log file is going to be a big size due to whatever reasons. I would like to be truncated or be ignored this log at this moment, but this file is connected to a running process.

Solution one of my colleagues gives me a brilliant solution to do that without interrupting a process.

 cat /dev/null > file_to_be_truncated

Before                786658068 Mar 19 09:40 Xterm.log.2012.
After                                         0 Mar 19 09:53 Xterm.log.2012.
After few mins               1747 Mar 19 10:07 Xterm.log.2012.

posted by citadel