Thursday, June 4, 2009

Hibernating Sage Server & Waking Up HD Theaters

I've finally gotten around to optimizing the powered on time of the media server. To get started, I have Sage export its recording schedule to a network drive by setting this option in scheduler_export_file=. I just specify the path to the file I want it to dump to. It creates a tab delimited file containing the recording schedule for the coming week. I parse this file daily at 1AM and keep track of the earliest start time and latest end time for the day.

The server gets shut down sometime after we've gone to bed and after the last recording. It actually gets hibernated remotely from the HA server using psshutdown. I use the command psshutdown -h \\machine-name to initiate hibernate.

The problem with hibernate is that wake on lan will not work to bring the machine up, but it will work when the machine is shut down or in standby. I opted for hibernate since the machine comes up faster than from power off and uses less power than standby. I needed a way to automatically push the power button to turn on the server. I wired this relay to the power button, connected it to a 12v wall wart plugged into a UPB appliance module. Now, my HA server sends a UPB command to turn on the wall wart & then turn it off. This causes the relay to close and activate the power switch before the relay opens again.

Once Sage is awake, I have EventGhost macros that check to see if the server just came on or came out of hibernate. Those macros then kick off a python script that telnets to the HD Theaters and reboots them so they are powered up and waiting on the sage menu.

import telnetlib

tn = telnetlib.Telnet("")

tn.read_until("login: ")


No comments:

Post a Comment