Null values after emptying a log file

Hi,

I have a log file which is constantly being written to by some process. I need to clear that log file on a daily basis.

The problem is that when I issue this command:

echo "" > logfile.log

the file gets filled with nulls thus increasing the size of the file.

Is there a way to pause/stop the process, then copy the logfile to some name and then clearing the original logfile, then restarting the paused/stopped process?

I am doing all this in a shell script.

Thanx

Regards
2me

See this post .

I tried this and it worked the way expected - removed the contents of the file and left one blank line.

> should cause the file to be truncated to zero length if it exist - and the noclobber option is off.

Ok I would give a try.

Send a SIGSTOP signal to the process which you want to pause/stop, copy the log files to target directory and finally issue a SIGCONT signal to the same process.

The problem as stated by you is extras null being inserted in the "log" file could be caused of improper write( ) call to the log file. Check the length of the data being written in the file.