I have a process which is continuously writing into a log file. I want to empty the contents of the log file without having to restart the process.
I have used various commands:
: > log.txt
echo "" > log.txt
truncate -s 0 log.txt
cat /dev/null > log.txt
They all truncate/empty the content of the log file but only temporarily. When a few minutes later process updates the content, log file size (and contents) goes back to (and newer content) what it originally was.
what might be going on and how I can permanently empty the log file contents ?
>>to append the newer content to a file.