[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Put server to sleep (hibernate/suspend) automatically after inactivity?



Hello experts,

I've been setting up my first real (albeit small) home server on Debian (etch) in the past days, and I have some problems regarding the implementation of my
specific goals.

My question boils down to this:

Can I tell the server, using a mechanism available when there is no user
logged in, to automatically go to sleep (suspend to disk/hibernate) after a certain amount of inactivity? I.e., I am looking for settings such as those
available in the GNOME power manager, but to be used for the system in
general.

(Let me know if the people on debian-laptop might the ones to ask here, I din't
want to cross-post to two lists.)

I guess one of the problems is the definition of "inactivity" on a server as there will probably always be things going on due to some services running.

Read on for the details and background, which might help in narrowing down
criteria for "inactivity". These are my requirements:

1) Main use of machine (for now): file server, mostly for rsync backups or
   storing of archive (files used not regularly).

2) Machine to be run 'headless' (without monitor and physical access, i.e.
   stored away in the basement).

3) Machine to be put in 'suspend to disk' mode when inactive, to be woken up via magic packet over ethernet (wake-on LAN) when one of the clients needs
   access (i.e. to perform an rsync backup).

My machine is using an AMD Athlon processor (1 GHz) with 768 MB of RAM on an ASUS A7V133 board. I am using two SATA disks on a PCI controller (SiI 3512A)
to run a software RAID with LVM for Debian etch on it.

I did install a desktop environment (GNOME), too, for various other reasons, and could not get the suspend features of gnome-power-manager to work. I.e.
the settings for "put computer to sleep when it is inactive for ..." do
nothing, and I can't manually suspend the system via the GUI, either (the
little power plug symbol in the menu in the upper right).

I can, however, suspend the machine with "sudo s2ram -f" or "sudo s2disk". I've been searching the internet for solutions to why I can't use the nice
interface in the GUI, and am puzzled by the plethora of different power
management
packages etc. that are available and all the problems associated with them.

I have tried several things suggested to make the GUI method work (made sure my user account is in the admin group in /etc/sudoers , added my account to the powerdev group etc.), but nothing helped. When I power up the machine, I don't want an automatic login into a desktop session, instead I usually want to contact the machine over ssh (and occasionally over VNC) or on other ports
(rsync daemon).

So ideally I don't need to the GUI solution to work, but I thought that maybe an alternative would be to automatically let the system boot into a desktop session under a (dedicated) user account and then use the features of the GUI.

The least ideal solution, I guess, would be to let the clients explicitly tell
the server "I don't need you anymore, go to sleep" (over ssh).

It's a home server, I don't expect more than one or two clients to be
connected simultaneously, for a limited number of purposes such as rsync, and the clients could execute commands via sudo. When given the command to sleep, the machine could check if another user is using the server or if another person is communicating with the the rsync daemon to see it the machine can be
put to sleep.

Or is all this too unreliable and complicated? Do you have ideas? The purpose, obviously, is to avoid running a 100 W device all the time when usually it is
not needed.

Thanks for your thoughts!
-Moritz



Reply to: