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/test.sh
#!/bin/sh
# 49 should be swapped for just a couple minutes in the future of now
while [ `date +'%M'` -lt 49 ];
do
exit 1
done
exit 0
Now in perl we will run system and test for clean exit until it is finished
perl -e 'while (system("/tmp/test.sh") != 0) { print "not done..."; sleep 5; } print "complete"; '