Why not store the filesize instead of the line count? Then your 5 steps become
- Query filesize
- If the file has grown since last time, open the file and seek to the previous eof.
- Read the new lines and persist the new filesize.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.