-
-
Save alex88/f2c337ea57693c2e97bff2ecc64dc8b2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "Start" . PHP_EOL; | |
sleep(60); | |
echo "Stop" . PHP_EOL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
_cleanup() { | |
echo "Caught SIGTERM signal! Sending to child and exiting loop" | |
kill -s INT "$child" | |
wait | |
exit | |
} | |
trap _cleanup SIGINT SIGTERM | |
while true; do | |
php script.php & | |
child=$! | |
wait "$child" | |
done | |
echo "Done, exiting" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment