error emptying syslog file with shell
List,
I have an ever-growing syslog file which I want to flush every hour.
So I schedule a crontab with only the following command:
echo "" > logfile (or "> logfile", which is the same)
Now when I type 'more logfile' after it has been flushed, the output looks like:
^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@ ^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@
The funny part is that a 'tail logfile' works fine, so I guess that there is something on the first line that causes the shell to interpret it as binary or something (at least not a textfile).
Is there a better way to flush a logfile? Or do I have to add/remove something in the first line of the logfile to make it readable by 'more' again?
Any help is greatly appreciated...
Kind regards,
Phil
|