Truncating a file while it's being used (Linux)

后端 未结 13 2023
名媛妹妹
名媛妹妹 2020-12-05 01:54

I have a process that\'s writing a lot of data to stdout, which I\'m redirecting to a log file. I\'d like to limit the size of the file by occasionally copying the current

相关标签:
13条回答
  • 2020-12-05 02:50

    I had a similar issue on redhat v6, echo > file or > file was causing apache and tomcat to go faulty as log files would become inaccessible to them.

    And the fix was strange

    echo " " > file
    

    would clean the file and not cause any problem.

    0 讨论(0)
提交回复
热议问题