Just use forever
with your php script (use the -c
argument to instruct forever to use php
):
$ cat test.php
<?php
sleep(3);
print("foobar\n");
exit;
?>
$ forever -c php test.php
foobar
error: Forever detected script was killed by signal: null
error: Forever restarting script for 1 time
foobar
error: Forever detected script was killed by signal: null
error: Forever restarting script for 2 time
...