I have a Perl daemon which runs 24 X 7 and It is running something like this
my_program.pl > /logs/user/data.out
my_program.pl will write only in data.out file only when there is an error in the application, otherwise it will not write in it .
Now I am application which does the cleanup and check if the file is under /logs/user/
is 2 days old it deletes the file and it is not getting any error while deleting .
But the consequence of this is files being deleted and left in an open state which is causing Disk Space issue on the server.
Now what I am trying to do is to check in my cleanup program if the file is open don't delete it but i am not able to identify it as the cleanup application i have only filename and it's path .
I tried the suggestion given in the below links but nothing is helping me in that .
How do you check if a file is open using Perl? How can I check if a filehandle is open in Perl?
Could you please suggest how we can handle this condition in Perl