Kim.T;269611 Wrote: 
> The thing about WOL and hibernation sounds interesting.

I have my SqueezeCenter server set to suspend/hibernate when it is
idle
    
- 1.5 hours before suspend (resumes in <15s, uses 4W with WOL)
- 2 days before hibernate, with automatic transition from suspend
  using RTC wake alarm (resumes in <60s, uses 3W with WOL)
- 5 min grace period for activity after wake/resume
- poll for active players in SqueezeCenter ever 60s (want to make
  sure it's less than average track length)
  

Here is an example with much shorter timeouts
    
- 15s before suspend
- 2 min before hibernate
- 30s grace period for activity after wake/resume
- poll for active players in SC7 every 10s
  

  
  
- Start script (normally runs as daemon from init)
    
Code:
--------------------
        
    [EMAIL PROTECTED] ~]# /usr/local/sbin/sc-idle.py --demo 
--pm-arg=--quirk-s3-bios
    2008-04-02 18:55:37,921 DEBUG Configured options: {'demo_mode': True, 
'daemon': False, 'cli_host': 'localhost', 'pid_path': None, 'pm_arg': 
'--quirk-s3-bios', 'rtc_padding': 0, 'log_config': '/etc/sc-idle/logging.ini', 
'cli_port': 9090, 'poll_delay': 10, 'nosleep_path': '/tmp/nosleep', 
'resume_delay': 30}
    2008-04-02 18:55:37,922 INFO Monitor started
    
--------------------
    
- User pauses currently playing track
    
Code:
--------------------
        
    2008-04-02 18:55:37,923 DEBUG Connected cli on localhost:9090
    2008-04-02 18:55:37,928 DEBUG Disconnected cli on localhost:9090
    2008-04-02 18:55:37,929 DEBUG System entered idle state
    2008-04-02 18:55:37,929 DEBUG Cannot enter hibernate (ACPI S5), need 
0:01:59.999716
    2008-04-02 18:55:37,930 DEBUG Cannot enter suspend (ACPI S3), need 
0:00:14.999438
    2008-04-02 18:55:47,928 DEBUG Connected cli on localhost:9090
    2008-04-02 18:55:47,934 DEBUG Disconnected cli on localhost:9090
    2008-04-02 18:55:47,934 DEBUG System has been idle for 0:00:10.005192
    2008-04-02 18:55:47,934 DEBUG Cannot enter hibernate (ACPI S5), need 
0:01:49.994582
    2008-04-02 18:55:47,935 DEBUG Cannot enter suspend (ACPI S3), need 
0:00:04.994352
    2008-04-02 18:55:57,933 DEBUG Connected cli on localhost:9090
    2008-04-02 18:55:57,939 DEBUG Disconnected cli on localhost:9090
    2008-04-02 18:55:57,939 DEBUG System has been idle for 0:00:20.010272
    2008-04-02 18:55:57,940 DEBUG Cannot enter hibernate (ACPI S5), need 
0:01:39.989510
    2008-04-02 18:55:57,940 INFO Enter suspend (ACPI S3) after being idle 
0:00:20.010272
    2008-04-02 18:55:57,940 INFO Set RTC wake alarm to '2008-04-02 22:57:37'
    
--------------------
    
- RTC wake alarm powers on system to enter hibernate mode (normally
  this happens after 2 days of inactivity, protection against AC loss
  while user is away). Note that my hardware clock is UTC and the local
  time (used in log messages) is for New York
    
Code:
--------------------
        
    2008-04-02 18:57:56,353 DEBUG Return from suspend (ACPI S3), waiting 30 sec 
for activity
    2008-04-02 18:58:36,348 DEBUG Connected cli on localhost:9090
    2008-04-02 18:58:36,353 DEBUG Disconnected cli on localhost:9090
    2008-04-02 18:58:36,354 DEBUG System has been idle for 0:02:58.424532
    2008-04-02 18:58:36,354 INFO Enter hibernate (ACPI S5) after being idle 
0:02:58.424532
    
--------------------
    
-  Press power button on SqueezeBox remote, sends WOL packet to
  server to wake it from hibernation (system also does this when AC
  power is restored after loss, so it will re-hibernate). In this case
  the user doesn't start playing music, so the grace period expires and
  the system goes back into hibernation
    
Code:
--------------------
        
    2008-04-02 19:00:35,758 DEBUG Return from hibernate (ACPI S5), waiting 30 
sec for activity
    2008-04-02 19:01:15,751 DEBUG Connected cli on localhost:9090
    2008-04-02 19:01:15,756 DEBUG Disconnected cli on localhost:9090
    2008-04-02 19:01:15,757 DEBUG System has been idle for 0:05:37.827774
    2008-04-02 19:01:15,757 INFO Enter hibernate (ACPI S5) after being idle 
0:05:37.827774
    
--------------------
    
- User wakes server again using SqueezeBox remote and un-pauses the
  track they were playing
  2008-04-02 19:02:40,748 DEBUG Return from hibernate (ACPI S5),
  waiting 30 sec for activity
    
Code:
--------------------
        
    2008-04-02 19:03:20,742 DEBUG Connected cli on localhost:9090
    2008-04-02 19:03:20,746 DEBUG SqueezeCenter players are active
    2008-04-02 19:03:20,747 DEBUG Disconnected cli on localhost:9090
    2008-04-02 19:03:20,747 DEBUG System left idle state
    
--------------------
    
  

It is much more simple to shut down the server at a preset time using
cron, but my listening habits are not quite so regular.

Also worth considering that suspend/hibernate is dependent on
system/BIOS support. It works well on ACPI compliant systems, but there
are often quirks to work around using the options in pm-utils. For
instance my Core Solo system needs --quirk-s3-bios to reinitialize
video + SATA drive, and I have pm-utils remove and reinsert the
uhci_hcd module as USB keyboards would otherwise not work after resume.
Without --quirk-s3-bios the filesystem gets corrupted (every time,
seconds after startup) and the display stays dark. It's not a fun debug
process, but now it works flawlessly. :)

Probably not good for people new to Linux, but it does reduce energy
consumption, unnecessary noise, and may even prolong system life if you
don't play music 24x7 (esp with 2.5 in laptop disks).


-- 
syburgh
------------------------------------------------------------------------
syburgh's Profile: http://forums.slimdevices.com/member.php?userid=14239
View this thread: http://forums.slimdevices.com/showthread.php?t=43319

_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/unix

Reply via email to