Created Tue Jun, 11 2019 at 09:53AM

Here is a quick little snippet to run a process until the process exits cleanly (0 - exit code).

I first created a sample shell script to exit 1 for a few minutes, then exit 0. cat /tmp/

# 49 should be swapped for just a couple minutes in the future of now
while [ `date +'%M'` -lt 49 ];
  exit 1
exit 0

Now in perl we will run system and test for clean exit until it is finished

perl -e 'while (system("/tmp/") != 0) { print "not done..."; sleep 5; } print "complete"; '