[mythtv-users] Autostart frontend ONLY on manual startup?
Calvin Harrigan
charriglists at bellsouth.net
Fri Mar 4 16:02:01 UTC 2005
Fredrik Karlsson wrote:
>HI,
>
>I think I understand what you want. Here is what I did:
>
>I created a startup script which sets lockfile only if the sciript is
>supplied with the argument "auto":
>mythtv at mythtv mythtv $ cat /usr/local/bin/mythguictrl
>#!/usr/bin/perl
>
>use warnings;
>use strict;
>
>package main;
>
>my $lockfile = '/var/run/mythtv/mythguilockfile';
>
>my $who = $ARGV[0];
>
>system "rm $lockfile" if -e $lockfile;
>
>if($who eq "auto"){
>
> system "echo 1 > $lockfile";
>}
>
>exit 1;
>
>#---------------------------
>
>Next, I created .xinitrc and .xsession files looking like this:
>mythtv at mythtv mythtv $ cat .xinitrc
># Merge X resources from ~/.Xdefaults
>[ -f $HOME/.Xdefaults ] && xrdb $HOME/.Xdefaults
>
># Set the background and root cursor shape
>xsetroot -solid \#400040
>xsetroot -cursor_name top_left_arrow
>
># Start evilwm - snap to borders within 10 pixels
>/usr/bin/evilwm -snap 6 -bw 0 &
>
>/usr/X11R6/bin/xset s noblank &
>/usr/X11R6/bin/xset s off &
>/usr/X11R6/bin/xset -dpms &
>#/usr/bin/xsetbg /home/mythtv/.mythtv/silent-800x600.xpm
>/usr/X11R6/bin/xsetroot -solid black
>
>[ -f /var/run/mythtv/mythguilockfile ] || mythfrontend &
>
>
>
># sleep makes it so irxevent works
># uncomment these if you don't compile lirc into mythtv (set the lirc
>USE variable to compile lirc support into mythtv)
>sleep 3
>irxevent &
>
># Transfer control to xclock - killing xclock (with Ctrl+Alt+Escape, say)
># will exit our session
>exec xclock -digital -padding 2 -g -0+0
>#----------------------------
>
>So, the frontend is ONLY started when the lockfile does not exist.
>Finally, I set the startup command (in mythsetup) to
>/usr/local/bin/mythguictrl $status
>
>
I have a similar setup using a C++ program that I wrote called, of all
things, MythSplash. On an startup I have a small perl script (I think I
used perl, over a year now) that is called from mythbackend telling
whether or not the system was booted in automode. What the script does
is copies one of two .xinitrc files into the mythtv home directory. One
file starts mythfrontend on a manual start (no pending recordings), when
mythfronted is exited, it then calls mythsplash that gives a 'blue'
themed screen that says myth is shutting down, hit enter to restart, if
pressed mythfrontend restarts. In automatic mode the script calls
mythsplash but this time, mythsplash displays a message indicating that
mythtv is in auto mode hit enter key to start mythfrontend. Once
mythfrontend is shutdown mythsplash is displayed again. Indicating
Automode. There are a couple gotcha's. If you turn on mythtv say just
before a recording is due, it will start in automode, because it thinks
it's being started by nv-wake or something. The other is that the query
that being used internally in mythbackend to determine whether
mythbackend should be in automode doesn't handle previously recorded
programs or disabled programs. For example if you are on the 'upcoming
recordings' screen within mythfrontend, it will show the grayed out
shows (disabled or previously recorded) and actually scheduled
recordings, the grayed out shows seem to confused the the manual/auto
function in mythtv. If I turn on mythtv when one of these disabled
shows might have been recording, mythtv starts up in automode. Not a
big deal for most part, but sometimes when mythtv is awaken remotely
(via network) it starts in automode and sometimes shutdown before the
slave is fully booted to connect to the backend. Hopefully when I get
some time I'll be able to look at the code and submit a patch.
Hopefully... If anyone is interested in mythsplash let me know, I'll
clean it up a bit and perhaps make it theme-able.
Calvin....
More information about the mythtv-users
mailing list