[mythtv] making mythbackend be a daemon

Chris mythtv-dev@snowman.net
Sun Jan 5 19:24:21 EST 2003


If mythbackend is running in the background, can you run another player
such as xine (having them access different /dev/dsp's). 

On Sat, 2003-01-04 at 22:10, Andrew Heybey wrote:
> I do not (yet) have a computer dedicated to mythtv; I am playing with
> it on the family computer.  I wanted mythbackend to start up at boot
> time so that programs would be recorded automagically in the
> background.  I also wanted multiple users to be able to run
> mythfrontend to use mythtv.
> 
> So I made a few minor changes to the CVS version (as of about 30
> December) and various changes to my system configuration and it seems
> to work.  I thought it might be of interest to other people so here is
> what I did.
> 
> This is on Redhat 8.0; I am a Linux newbie (I usually run FreeBSD) so
> I do not know how applicable the startup script and the configuration
> stuff is to other distributions.
> 
> 1. Apply the attached "mythbackend.diff" patch (just a couple of
>    changes).  This patch makes mythbackend work even if there is no
>    DISPLAY since it no longer creates a widget.  I haven't yet tried
>    to use daemon(3) but that would be the obvious next step.
> 
> 2. Create a "tv" user and a "mythtv" group.  Make the home directory
>    of "tv" be /usr/local/share/mythtv.  Add users who will use
>    mythtv to the "mythtv" group.
> 
> 3. "chown -R tv:mythtv ~tv" to give ownership of mythtv files to the
>    tv user and mythtv group.  Do the same for your mythtv data
>    directory if it is not underneath /usr/local/share/mythtv.
> 
> 4. "chmod g+w your_mythtv_data_directory" to let members of group
>    "mythtv" create and delete files in the directory where video data
>    is stored.  (Not sure if this is actually required since I think
>    that files are only created/deleted by mythbackend which will be
>    running as the "tv" user.)
> 
> 5. Change the lines dealing with sound and v4l in
>    /etc/security/console.perms as follows so that the devices have
>    permissions that allow mythbackend to access them.  Permission 640
>    might suffice...
> 
> <console>  0660 <sound>      0660 root.mythtv
> <console>  0660 <v4l>        0660 root.mythtv
> 
> 6. Install the attached "mythtv.sh" script as /etc/init.d/mythtv (ie
>    rename it to remove the ".sh").  Do "chkconfig mythtv on".  I had
>    to put "modprobe bttv" in the script to make sure that the bttv
>    module gets loaded.  I am sure that this is the Wrong Thing to do,
>    but I don't understand enough about Linux yet to know the Right Thing.
> 
> 7. Make sure that all the channel icons are readable by the "tv" user.
> 
> It seems to work for me, but YMMV.  One thing I thought of while
> writing this email is to set the mixer setting to the proper values in
> the mythtv.sh script.
> 
> andrew
> ----
> 

> Index: programs/mythbackend/main.cpp
> ===================================================================
> RCS file: /var/lib/cvs/MC/programs/mythbackend/main.cpp,v
> retrieving revision 1.4
> diff -u -u -r1.4 main.cpp
> --- programs/mythbackend/main.cpp	30 Dec 2002 07:40:55 -0000	1.4
> +++ programs/mythbackend/main.cpp	5 Jan 2003 02:30:11 -0000
> @@ -136,7 +136,7 @@
>  {
>      QApplication a(argc, argv);
>  
> -    MythContext *context = new MythContext;
> +    MythContext *context = new MythContext(false);
>      context->LoadSettingsFiles("backend_settings.txt");
>  
>      QSqlDatabase *db = QSqlDatabase::addDatabase("QMYSQL3");
> @@ -168,7 +168,9 @@
>      int statusport = context->GetNumSetting("StatusPort", 6544);
>  
>      MainServer *ms = new MainServer(context, port, statusport, &tvList);
> +#if 0
>      a.setMainWidget(ms);
> +#endif
>  
>      a.exec();
>  
> Index: programs/mythbackend/mainserver.h
> ===================================================================
> RCS file: /var/lib/cvs/MC/programs/mythbackend/mainserver.h,v
> retrieving revision 1.6
> diff -u -u -r1.6 mainserver.h
> --- programs/mythbackend/mainserver.h	30 Dec 2002 07:40:55 -0000	1.6
> +++ programs/mythbackend/mainserver.h	5 Jan 2003 02:30:15 -0000
> @@ -14,7 +14,7 @@
>  class MythContext;
>  class HttpStatus;
>  
> -class MainServer : public QVBox
> +class MainServer : public QObject
>  {
>      Q_OBJECT
>    public:





More information about the mythtv-dev mailing list