Automatic shutdown using ping
Hi all,
I have set up a Linux server to serve various devices (i.e. MP3 playback in the living room). The server automatically starts up using wake on LAN. I would like the server to shutdown automatically as well. I think about a script using "ping" to check if any of the served devices is up (using a list of IP addresses) and shutting down when none is available for 15 minutes. Did anybody already do this or has another solution and can provide a matching script? |
Not sure if ping is the right solution. A lot of services use icmp to check availability of a host so this could result in the server going down randomly. I once read a LJ article on port knocking. The idea is to parse the firewall logs for a certain knock sequence and then take appropriate action. Like opening up a port or something. This sure can be expanded to call shutdown on receiving a predefined shutdown knock sequence.
Here's the article: http://www.linuxjournal.com/article.php?sid=6811 edit: oops. I guess I misread your question as well. The keyword being automatically shut down the server... Yeah, then the port knocking thing is not such a good idea. |
wrong - i misunderstood what u asked :(
|
Does your distro and hardware support ACPI? You could just use that and set the monitor, HD, and system to shut down after 15 min inactivity.
|
Thanks for all the replies.
I do not think ACPI will do the job since there is no way to define "system activity" as "is the server serving any clients". As far as I know it rather reacts on mouse and keyboard activity. I can use it the stop the HD when it is not accessed and thereby saving some energy and reducing noise, so thanks for that idea. What I am looking for is completely shutting down the system when it is not needed. And for my purpose not needed means that no potential clients are up and running. That's why I thought ping might be the solution. |
All times are GMT -5. The time now is 08:10 PM. |