Issues with ACPI_Wakeup

Have a MythTV related problem? Ask for help from other MythTV users here.

Moderator: Forum Moderators

Post Reply
Posts: 6
Joined: Thu Aug 27, 2015 6:58 pm
Great Britain

Issues with ACPI_Wakeup

Post by akc42 » Sun Sep 27, 2015 11:17 am

I am running Debian Jessie with the debian-multimedia version of mythtv and Gnome as my desktop manager

I have been trying to get my desktop, also running mythtv to shutdown automatically and wake up again in the middle of the night if I have decided to record a program then.

I found a couple of issues with the two scripts that you have to make as described on the Wiki Page.

Firstly, a purely cosmetic issue, but I puzzled for a while why my logs for the wakealarm script were displaying the correct wake up time, but adding an hour to the time until wake up in the log.

I turned out that it uses date -d @$b +%HHrs:%MMins to display the gap. variable b holds the seconds between now and the wakeup time. What it is actually doing is displaying the time since Jan 1, 1970 at 00:00 UTC in local time and since I am currently in British Summer Time it is displaying an hour extra. What is needed is that command should be date -u d @$b +%HHrs:%MMins

However the more serious problem is that when nobody is logged in, the output of who -q is
# users=1
So the script as quoted in the wiki page was never finding no-one logged in

What I have done so far is the following:-

Code: Select all

XFCE_PROCS=`pgrep xfce`
UNKNOWN_USER=`who -q | head -n 1 | sed 's/(unknown)//'`
USERS=`who -q | tail -n 1 | sed 's/[a-z #]*=//'`

if [ "$USERS" == "1" ] && [ "$UNKNOWN_USER" == "" ] && [ "$XFCE_PROCS" == "" ]; then
    echo $DATE No users are logged in, ok to shut down.
    exit 0
    echo $DATE Someone  still logged in, don\'t shut down.
    exit 1
But this feels rather fragile. Is there a better way of doing this?

Incidentally, the Wiki page also says that the output from this script goes into the logs, but I couldn't find it there. In the end I changed the pre-shutdown command to have >> /var/log/mythtv/checklogin.log appended to it, so it forced its output into a log

Post Reply