MythWelcome - MythTV Status and Shutdown/Wakeup Assistant

MythWelcome is a utility program that is designed to be run in place of MythFrontend. It provides a display of MythBackend status information, such as current recordings, upcoming recordings, and commercial flagging jobs.


Assists With Shutdown

MythBackend is responsible for shutting down the computer whenever it is idle. MythBackend will not shutdown the system whenever any MythFrontend is connected.

MythBacked will report its official status as "idle" even when MythFrontends are connected.

This is true even if a MythFrontend is just displaying a menu and doing nothing else. This includes not only a MythFrontend on the backend server, but also MythFrontends connected via the network. MythBackend will wait until all MythFrontends are closed before initiating a shutdown.

This is where MythWelcome comes in handy. You can run MythWelcome rather than MythFrontend and the shutdown process is not prevented. However you can still launch MythFrontend from the MythWelcome screen if desired. Just remember to exit back to MythWelcome when done.


Choosing MythWelcome over MythFrontend

With the MythDora distribution you can use the mythdorasetup.pl script to specify MythWelcome as the startup program. From the main menu; select Frontend startup and then Start MythWelcome on login from the ensuing menu. You can also hand edit the . start_frontend file in your home directory; changing the contents to mythwelcome.

By default, MythWelcome will also startup MythFrontend. You will need to disable this behavior, otherwise MythBackend will not be able to shutdown the system. See the configuration section at the end of this document for instructions.


Alarm Clocks are Tomorrow Technology

Like the alarm clock on your night stand, many ACPI alarms will only wake up your computer today or tomorrow. Any scheduled wakeup for recording that is more than 24 hours in the future can be a real headache for some motherboards. The ACPI alarms of these motherboards only accept the time-of-day and not the date. Regardless of the requested time/date, the computer will wakeup when the time matches the request. Always within the next 24 hour period. The date portion of the request is simply ignored.

Each time a MythBackend computer shuts down, it programs the ACPI wakeup alarm with the time and date of the next scheduled recording. If the recording is within 24 hours, the computer will wake up correctly. If it's for the following day or any later day, the computer will wakeup incorrectly on the wrong day. MythBackend will quickly realize that it has nothing to do, and will initiate a new shutdown, once again programming the ACPI alarm for the next scheduled recording. The computer will wakeup over and over again every day, at the appointed time, until the correct day arrives.


Daily Wakeup Alarms Restore Order

If this erratic behavior bothers you, then you can schedule a daily wakeup at a predetermined time. Press the "i" key (info) while on the MythWelcome status screen to configure this option. The system will still wakeup and realize that it has nothing to do and then shutdown again. It will reschedule for the next recording, but at least you have control of when it wakes up.

MythWelcome provides for two of these daily wakeup alarms. This functionality works independently of the MythBackend scheduler. The daily wake up alarms can, and often do, conflict with the MythBackend recording wakeup times. The ACPI can only handle one wakeup request at a time, unfortunately MythWelcome will exclusively schedule its daily wakeup even when the computer must wakeup to record at an earlier time. In fact it is not possible to have daily wakeup alarms and recording wakeup alarms on the same day. The only way you could make recordings is if their start time falls within the window of time created by the daily wakeup alarm.

MythWelcome does nothing to resolve this conflict. Luckily, our version of /usr/bin/setwakeup.sh fixes this problem. This script compares potential wake up times and correctly programs the ACPI alarm with the earliest occurring one, overriding the bad behavior of MythWelcome.


Configuring MythWelcome and MythShutdown

The MythWelcome configuration screen can be displayed in either of two ways. You can execute the command mythwelcome --setup from the command line, or you can press the F11 key whenever MythWelcome is displaying its main screen. This configuration screen also has settings that apply to the MythShutdown utility:

Command to Set Wakeup Time: sudo /usr/bin/setwakeup.sh $time

This field names the program that will be used to set the time at which the system will wakeup. MythWelcome only uses this program to set daily wakeup alarms. Note that MythBackend has a separate configuration that specifies the program that will set recording wake up time. However, both configurations may point to the same program name. In this field, $time is replaced with the "time to wakeup" when the named program is executed. The format of this time data is specified by the Wakeup time Format field (see below).

The /usr/bin/setwakeup.sh program needs root privileges to operate properly. Therefore it needs to be added to the sudoers list. Edit the file /etc/sudoers and add /usr/bin/setwakeup.sh to the list of files that are assigned to Cmnd_Alias MYTHDORA. It should look similar to the following:

Cmnd_Alias MYTHDORA= /usr/bin/setwakeup.sh, ...
Wakeup time Format: yyyy-MM-dd hh:mm:ss

The format of the $time parameter passed to /usr/bin/setwakeup.sh described above. The format can be any that is acceptable by the date command. The format shown in the example here is preferable as it reflects what is expected by /proc/acpi/wakeup

nvram-wakeup Restart Command:  

The name of a program to run when the BIOS requires a reboot to make the wakeup time take effect. This is an nvram-wakeup specific setting and does not apply to ACPI alarms. For the purpose of this article, leave this field blank.

Command to reboot: /sbin/reboot

The name of the program that will reboot the computer. It is likely that this is only used for the reboot sequence required to program the nvram wakeup timer. See the nvram-wakeup Restart Command above.

Command to shutdown: /usr/bin/poweroff

The name of the program to power down the computer. Press the " m" key from the main MythWelcome screen to display a menu containing the Shutdown Now command.

Command to run Xterm: xterm

The name of the program to open a terminal window. Pressing the F12 function key while on the main MythWelcome screen will launch the terminal window.

Command to run to start the Frontend: /usr/bin/mythfrontend

The name of the program that will start MythFrontend. You can start MythFrontend from the main screen of MythWelcome with a click on the Start Frontend button or a press of Enter on the keyboard.


The MythWelcome Setup Screen

Additional configuration for MythWelcome is performed on the Info screen. You enter this screen by pressing the "i " key while viewing the main MythWelcome screen.

Daily Wakeup/ShutDown Period 1
Period 1 start time 05:00 Period 1 end time 05:15

Setting the start and stop time to non-zero values enables the first wake up timer. In this example the computer will wake up at he scheduled time of 5:00am and will shutdown again and at 5:15am

Daily Wakeup/ShutDown Period 2
Period 2 start time 00:00 Period 2 end time 00:00

In this example, the second wake up timer is disable by setting both of its values to zero.

Automatically Start Myth Frontend

A check in this box will force MythFrontend to startup along with MythWelcome. This will prevent MythBackend from automatically shutting down the computer when idle. DO NOT check this box if you want the computer to shut down by itself.

Date Format: yyyy-MM-dd

This field specifies the format of the date to be displayed in the upper left corner of the MythWelcome screen. Any format string that is valid for the date command can be used here.

There is no user configuration for the time displayed in the upper right corner of the MythWelcome screen.