MaxEigelb wrote:
> Hi,
>
> i would like my little homeserver (SUSE 11.0 - no X, Via Esther 1GHz)
> to switch to standby after 60 minutes of no network-traffic. How to
> implement that?
>
> thanks a lot,
>
> Max
>
>
A small script should do it.
#!/bin/bash
# The function reads a kernel counter and calculates a unique checksum.
# ethernet port to be adjusted to your situation
md5 () { cat /proc/net/dev | grep eth1 | md5sum | cut -d' ' -f1; }
MD5a=$(md5) # Initial checksum of ethernet traffic
for ((i=0;i<60;i++));do # try for 60 minutes
sleep 60
MD5b=$(md5) # A second readout after a minute.
if "$MD5a" != "$MD5b" ]; # Anything changed?
then
exec sh -x $0 # Yes; restart script and counter
fi
done
# Nothing changed in the traffic count for one hour.
echo switching to standby
# Your code to switch to standby here