Progress bar progresses with background file update

Hi Guys,
In my app, what i am trying to do here is:
I have submit button and after clicking on submit button one background process runs and i am writing the status of process in text file.
What i need to do is, i have to update the progress bar based on the status update in text file.
Anyone can help me with that…please?

You can create an Interval component that triggers a callback, e.g. once per second, which reads the text file and update the progress bar accordingly.

DO you have any code that could help me in a better way ?
any code structure

Also, the text file is updating after x minutes 4-5 times…