Shutdown in background - PHP
- by William
I'm trying to shutdown an Ubuntu machine from PHP and am running into an issue if I want to delay the shutdown.
The PHP line I'm using is:
exec("sudo shutdown -h +5 &", $output);
Where 5 is however many minutes in the future I want to shutdown.
My problem is that this won't background and Apache hangs until either the machine is shutdown or someone else cancels the shutdown. shell_exec() has the same result.
Is there another way to do this that will return immediately?