I am running a CLI windows php script which is mostly a LOOP with some CMD exec functions. Problem is that these exec functions sometimes hangs up.
Can this script kill itself and restart itself ? '(for instance every 5 minutes)
I am running a CLI windows php script which is mostly a LOOP with some CMD exec functions. Problem is that these exec functions sometimes hangs up.
Can this script kill itself and restart itself ? '(for instance every 5 minutes)
Can this script kill itself and restart itself?
Not really, yet you can run another instance of itself and then quit the current one.
these exec functions sometimes hangs up
Then script cannot break from this by itself other by timeouting (see set_time_limit). Or you need to have separate watchdog to monitor your script and restarting it when needed.
(for instance every 5 minutes)
Rework your code to not loop and use cron or other scheduler (see What is the Windows version of cron?) to invoke your code periodically.