[mythtv-users] Copy frontend settings to new frontend keeping both

Karl Newman newmank1 at asme.org
Fri Oct 30 20:13:57 UTC 2015


On Fri, Oct 30, 2015 at 12:51 PM, Hika van den Hoven <hikavdh at gmail.com>
wrote:

> Hoi Mike,
>
> Friday, October 30, 2015, 7:21:35 PM, you wrote:
>
> > On Mon, Oct 26, 2015 at 1:46 PM, Hika van den Hoven <hikavdh at gmail.com>
> > wrote:
>
> >> Try:
> >> SELECT s1.value, s1.data AS old, s2.data AS new
> >>         FROM settings as s1 JOIN settings as s2
> >>         ON (s1.value = s2.value)
> >>         WHERE s1.hostname = '<existing frontend name>'
> >>         AND s2.hostname = '<new frontend name>'
> >>         AND s1.data <> s2.data;
> >>
> >> It lists all the differences between the two hosts in settings.
> >> If you have started the new host at least ones it will be filled with
> >> the defaults. It however does not show settings that exist only for
> >> one of the hosts.
> >> <https://forum.mythtv.org>
> >>
>
> > Thanks Hika.  Your query worked nicely for me.  In case anyone else is
> > interested I wrote the following bash script to use this query and
> compare
> > settings between two hosts.
>
> > #!/bin/bash
>
> > HOSTNAME1="$1"
> > HOSTNAME2="$2"
>
> > # Get info from config.xml
> > DBHOST=$(/usr/local/bin/getConfig.pl Database Host)
> > DBNAME=$(/usr/local/bin/getConfig.pl Database DatabaseName)
> > USER=$(/usr/local/bin/getConfig.pl Database UserName)
> > PASSWD=$(/usr/local/bin/getConfig.pl Database Password)
>
>
> > if [ "$HOSTNAME1" = "" -o "$HOSTNAME2" = "" ] ; then
> >   echo "usage: $0 <hostname1> <hostname2>"
> >   exit 1
> > fi
>
> > mysql -t -h $DBHOST --user=$USER --password=$PASSWD $DBNAME > /tmp/$$.tmp
> > <<!!
> > select s1.value,s1.data AS $HOSTNAME1, s2.data AS $HOSTNAME2 FROM
> settings
> > AS s1 JOIN settings AS s2 ON (s1.value = s2.value) WHERE s1.hostname =
> > '$HOSTNAME1' AND s2.hostname = '$HOSTNAME2' AND s1.data <> s2.data;
> > quit
> > !!
> > cat /tmp/$$.tmp
> > rm -f /tmp/$$.tmp
>
> > You'll get output like:
>
> >
> +----------------------+-----------------------+---------------------------+
> > | value                | nucfrontend           | nuci3frontend
> >
> +----------------------+-----------------------+---------------------------+
> > | AudioOutputDevice    | ALSA:default:CARD=PCH |
> ALSA:hdmi:CARD=HDMI,DEV=0 |
> > | ChannelGroupDefault  | 1                     | -1
> > | LircSocket           | /dev/lircd            | /var/run/lirc/lircd
>    |
> >
> +----------------------+-----------------------+---------------------------+
>
> Nice! You should however mention the limitations. Only settings that
> exist for both hosts and that are not equal are shown.
>

You could fix that with a LEFT JOIN, then all the settings for HOSTNAME1
which do not exist for HOSTNAME2 would show as NULL for HOSTNAME2.

Karl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20151030/80e8c18f/attachment.html>


More information about the mythtv-users mailing list