I have written a Perl script which executes a task as per the schedule.
Sometimes the task runs for 3 hours, and sometimes for 9 hours.
The status of the task changes to COMPLETE
after the task is done.
We have an internal CLI command which displays the status of the task. I'd like to implement a polling mechanism whereby the script checks the status of the task periodically and returns PASS
once the status changes to COMPLETE
.
One option is to run the command in a loop and check the status periodically. I was wondering if there are any other better or more reliable ways to check the status periodically. Perhaps implementing a scheduler or something on those lines.
Does anyone have any suggestions?