I have a php script with an environment variable from Fuelphp that I run with a command like
FUEL_ENV=production php oil run task however, I'd like it to run as a daemon that will automatically restart itself when it exits. The main reason it exists is due to memory usage, the task processes large amounts of data and slowly leaks (as PHP tends to)
I tried this but it puts the script in an endless loop that I can't kill (and so haven't even tried nohupping it as I don't think I can kill it)
while true; do FUEL_ENV=production php oil run task && break; done &
So what's the best way to set up a PHP script that will restart itself when it exists.