Shutdown via script over (W)LAN
-
Hi!
Thanks for the fast response.
What does shutting down the "cop" do?
Yes, It halts the system.
IP/halt.php
You could call this page with curl.This sounds quite nice already but I ve little issue with curl as I want to do the shutdown from several Systems(eg. Linux, iPhone, Mac, Windows, -curl needs to get "installed") and I was used to more or less just open that URL in whatever browser I want and it halted the system without prompting for credentials.
I am grateful for any hint ;)
-
Try the page on your device and see it it works. If not just create your own.
A simple script may look like
// Halts the system when the page is browsed // No authentication required (insecure) echo exec('shutdown -h now'); ?>
And save that to /usr/local/www/halt.php or whatever you want to name it.
-
Try the page on your device and see it it works. If not just create your own.
A simple script may look like
// Halts the system when the page is browsed // No authentication required (insecure) echo exec('shutdown -h now'); ?>
And save that to /usr/local/www/halt.php or whatever you want to name it.
Worked like a charme … ;D ;D ;D
I just replaced "shutdown -h now" with a "shutdown -p now"Thanks a lot!
-
Why shutdown -p? That just sounds unsafe.
-
Why shutdown -p? That just sounds unsafe.
With shutdown -h the system does not powerdown but with -p it does…
Why do you mean -p is unsafe? ???
-
shutdown -h does poweroff. Shutdown -h will halt the system and poweroff
shutdown -p will just power it off so it's the same as pulling the power. That's bad.
-
hmmm I am confused now….
According to the BSD manpage http://www.freebsd.org/cgi/man.cgi?query=shutdown&sektion=8-h The system is halted at the specified time.
-p The system is halted and the power is turned off (hardware support required) at the specified time.
…or do I understand something wrong here? ???
-
I know that -h will halt and shutdown because that's what I use. I guess you could experiment and see which one works best for you.
Let me know what you find out.
-
Hey!
I did some tests already and found out that with shutdown -h the system is doing a shutdown but it remains powered(on the screen you can read "press any key to reboot")
With shutdown -p system will be get "shutdowned" and powered off….
Maybe this behavior differs from system to system...?
-
Yeah, it has to differ from system to system.
I use shutdown -h all the time and it cuts the power after the shutdown process completes.Well I'm glad the php script worked for you. Take care!