I want to transfer some log files from one folder to another in Ubuntu operating system.
My question is how do I understand that a log file is written and no more writing is done on that?
Is there any command which would help identifying that?
Actually I want to do that through a shell script.
Thanks.
The lsof command can help you identify if any process is using a certain file.
For a simple example, I have created a test file in my home folder, and tailed to it.
This is the output of lsof for that file:
You can see the command that’s using the file, the pid etc.
Here are some more detailed and complex examples:
one and two