MLUG Bash Scripting Workshop 25/04/08
Prev Index Next

Autoshutdown: for turning off the server when no-one is using a workstation

We have a modest network at our house which includes a server which is used for timeshifting digital TV, NFS file shares and printer/scanner shares.

This box only has to be up if there is someone using one of the two workstatons or if someone has scheduled to save a TV show.

However, being that it has no monitor or keyboard attached the only way to shut this server down is via ssh before the last one out the door shuts down his/her workstation.

Two summers ago I got tired of thinking about how much extra heat this box contibuted to our home when no-one was home so I decided to figure out a way to have it automatically shutdown if nobody was using a workstation and there were digital TV shows scheduled to be saved

The result was a script a named autoshtdn. I don't have to introduce you to much more than what we have have covered so far. If you understood what I was doing in the script contovob you should be able to pick up on this script easily.

Autoshtdn uses conditional tests in if statements and creates variable from the results.


Top