[vdr] vdr-sxfe from background script

Ville Aakko ville.aakko at gmail.com
Fri Feb 20 22:54:55 CET 2009


2009/2/20 Alex Betis <alex.betis at gmail.com>:
> Hi all,
> I wonder what am I doing wrong.
> The problem is that when this script is run in background (& at the end),
> the job is shown as "stopped".
> I've tried to run vdr-sxfe itself in background, it opens the window and the
> job stops.
> I know there is a switch that will run it in daemon mode, but that's not
> that good for the script I want to have.

I think I hit the problem you are having before, but in my current
solution I do not need to face it. Currently, I log in automatically
via kdm, which loads KDE (could be xfce or whatever you want, though I
haven't tested because currently I want to use KDE) and automatically
runs a script (~/.kde/Autostart/vdr-sxfe.sh) that starts vdr-sxfe. I
don't background the vdr-sxfe.sh process in the script. I have two
loops there; the second is in case vdr-sxfe crashes, to restart
vdr-sxfe (vdr-sxfe doesn't do that anymore quite often) and the second
is for suspend / resume (some parts of lirc/VFD don't like suspend on
my setup). The latter waits from the start of suspend until end of
resume to restart vdr-sxfe. And, also it looks for the errorlevel of
vdr-sxfe ehwn it exits; if it is not a "clean" one, it assumes it was
not initiated by the user (and allows automatic shutdowns).

Do you really need to background vdr-sxfe the way you try to do it? On
my setup, If I want to exit vdr-sxfe to use the desktop (actually, I
don't need to do that but I can, also this disable automatic shutdowns
on my setup via a kludge) I just press esc on my keyboard to shutdown
vdr-sxfe (this leaves vdr running in the background). I have bound
another button to restart vdr-sxfe again (to enable automatic
shutdowns etc.).  You could kill all running vdr-sxfe sessions
whenever you run the script again (so that would actually work as a
restart, too, Though, I don't need restarting vdr-sxfe, so I haven't
done it). I can send my script if you need it.

The rest might be offtopic or not, but I think in general your problem
is related to a lack of documentation / examples / init scripts etc.
needed when configuring VDR to display via X (as opposed to a full
featured card or some other deticated output device that doesn't
require X)  At least for gentoo there are nice init sciŕipts and
configuration files for VDR and its plugins. But it seems that the
init scripts assume that a user has a full-featured card or another
deticated ouput device for the TV. But if one needs X for the display
instead (which more and more users will be using for several reasons),
I'm still really in the dark how to do that elegantly. Not even the
vdr-sxfe documentation had examples / ideas of ho to achieve the
automation! I.e. I want to have a VDR showing the picture via HDMI
without having to log in and running vdr-sxfe manually every time.

The problem might actually lie in the several differen't use cases
there are; some setup might only use the X for a deticated VDR, but
some other users would need other software to run under the X session,
too. In my case, I needed VDR to start automatically whenever I push
the power button,  but still have an easy way to switch to other
prorams and / or desktop. Of course this is a complicated matter, as
depending on the distribution / init scripts used, VDR might be run as
root or a detidcated user 'vdr', but the additional software would not
be run as such. I found the dilemma very confusing.

So, I had sevveral questions but no ready solutions / answers; How
should I start X.org / Which user should I run X as? Which user should
run vdr-sxfe (or some other X output backend)? And if I'm not using a
client/server setup, how on earth am I going to start an X session
before the init scripts run VDR, to play along nicely with the init
scripts? Do I need to log in as user 'vdr' (to start an X session)
before running VDR? Is it possible to allow the VDR process (which is
run as the user 'vdr') to connect to a X sessions, which is "owned" by
a different user?

Currently, I solved this via kdm's features and a script I made myself
to run at the start of a session as a regular user, and chose vdr-sxfe
to run as a client/server solution (this was the only solution I was
able to run at all with the init scripts Gentoo came with). But I feel
the script I made is really a dirty kludge =).

So I see there might be a need for documentation and solutions /
examples on this kind of setups (at least I didn't find any if there
already are). Can anyone point into such documentation? Does anyone
have any good personal examples? How do you run your VDR with an X11
output? Do you use the VDR box for other uses? If yes, how do you
integrate the other applications?

Hope this stirs some conversation =)

Ville Aakko - ville.aakko at gmail.com

More information about the vdr mailing list