Shutdown in background - PHP

Posted by William on Server Fault See other posts from Server Fault or by William
Published on 2011-11-30T01:52:36Z Indexed on 2011/11/30 1:54 UTC
Read the original article Hit count: 524

Filed under:
|
|
|

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?

© Server Fault or respective owner

Related posts about php

Related posts about shutdown