I have a php script which is generating a log file. On the other hand I have another script that should be running hourly to process the logfile.
In my second script, I want to copy and truncate the log file while it's been writing to without any dataloss.
In a limited test I've been using rename, to create the copy and I getting the expected results
But I have concerns over the correctness of this approach.
Is this safe to do?