Remove beginning of file without rewriting the whole file

前端 未结 3 1017
栀梦
栀梦 2020-12-29 06:21

I have an embedded Linux system, that stores data in a very large file, appending new data to the end. As the file size grows near filling available storage space, I need to

3条回答
  •  被撕碎了的回忆
    2020-12-29 06:55

    What about setting up a separate process that renames the output file when it reaches a predefined size (for instance by adding the linux time at the end of the file name).

    This would allow you to keep the old data and the main process will recreate the output file the next time it writes to it.

    Another cron job may remove the old file every now and then.

提交回复
热议问题