I have an old PC which acts as a server - fileserver, filtering web
proxy, mail server. The only users are family.

For years I've run it 24/7, only turning it off when I go on holiday,
but I've decided in future to run it only when it is needed (1).

While my wife and kids are well up to logging in over SSH and turning it
off from the command line, I'd like to have a point-and-click, or even
automated, solution. I've considered various possible ways of achieving
this, involving either:

(A) scripts on the clients run at startup or shutdown, or from a
..desktop file, which SSH (using RSA authentication) to the server. The
scripts could either run a command on the server or create a file as a
flag which is then checked by a cron job.

or

(B) continuous monitoring of clients by the server (using nmap or ping)
- see (2) for a quick kludged script.

but before I implement the above is there anything like this already
available? Desirable features would include support for Windows XP - not
essential - and an easy method of override for when I'm downloading
something big directly on the server overnight.

Mark Atherton


================================================== ====================

(1) Partly because I've stopped running a publicly accessible web server
on it, and partly because these "old PC"s are getting more powerful, and
power hungry. I used to use a 166MHz Pentium, downclocked to 75 MHz.
That ran *really* cool! That died eventually, so now I've got a 666MHz
PIII, which must consume many times as much power.


(2)

#!/bin/bash
#
# autoshutdown.sh
#
NETWORK=192.168.0
HOSTLIST=$(seq 10 20)
FLAGFILE=$(mktemp)
touch $FLAGFILE
while sleep 30
do
if [ -f /tmp/noautoshutdown
then
touch $FLAGFILE
else
for n in $HOSTLIST
do
ping -W 2 -c 1 -q $NETWORK.$n > /dev/null && \
touch $FLAGFILE
done
AGE=$(expr $(date +%s) - $(date +%s -r delete/) | dc)
if [ "AGE" -ge "600" ]
then
# More than 10 minutes since a ping reply received
rm $FLAGFILE
shutdown -h
fi
fi
done