I have a PHP script run from the command line like this: php test.php >> output.log. My output.log file has increased in size and I would like to implement some sort of rotation (archiving and truncating it when a certain condition is met). How can I do this, if I don't know the path to the file from within the code of the script, because it's set when it's called?
I see you can do it in Python as explained here: Is there a way to find out the name of the file stdout is redirected to in Python