[mythtv-users] Forcing the backend to acpi suspend with a frontend connected

Thomas Boehm mythtv-users at lists.boehmi.net
Sun Sep 25 22:20:28 UTC 2011


Thomas Boehm wrote:
> Marc MERLIN wrote:
>> On Sun, Sep 25, 2011 at 04:01:31PM +1000, Michael Watson wrote:
>>> On my Frontends, I run XScreensaver and a script via cron that waits for 
>>> the screensaver to be active for X minutes, then shutsdown the machine,  
>>> (or if it is a FE/SBE closes mythfrontend and allows mythwelcome to 
>>> shutdown the machine when the backend is idle).
> 
> Would you mind sharing it with us? I'm looking for such a working solution.

To answer my own question, here's a perl script which does it.
---------------------------------------------------------------------
#!/usr/bin/perl
#my $cmd = "dbus-monitor --session
\"type='signal',interface='org.gnome.ScreenSaver',
member='ActivateChanged'\"";

my $cmd = "dbus-monitor --session
\"type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'\"";

open (IN, "$cmd |");

while (<IN>) {
    if (m/^\s+boolean true/) {
        exec('killall mythfrontend.real');
    }
}
---------------------------------------------------------------------

One could run it on login, but I noticed that it only works once. I
don't know any perl, but maybe something like while (true) { } would do.
I added "/path/to/script.pl &" at the beginning of /usr/bin/mythfrontend
to execute it every time I start the frontend.


More information about the mythtv-users mailing list