[mythtv-users] Is there an approved may to remove frontend settings?

Bill Meek keemllib at gmail.com
Sun Feb 2 16:48:38 UTC 2014


On 02/02/2014 10:05 AM, R. G. Newbury wrote:
> On 02/02/14 07:18 AM, Anthony Giggins wrote:
>> is there an approved way to remove old frontend hostnames from the database?
>>
>> I've got a mix of old hostnames with a mix of with & without domain names.
>>
>> Happy if someone could point me at the correct tables I have a good
>> understand of SQL.
>
> "Approved"? No. Like any deep spelunking, it can get dangerous.
> So start with a backup of the database, or 2 or 3!
>
> The settings table holds settings for each 'instance' of myth. It sounds like you may have entries which actually point to the same box, due to
> your namechanges. And some entries are properly set to NULL. A complete mythtv setup puts about 250 settings into the settings table.
>
> As a first step, make sure that your computer has the correct hostname set in /etc/hostname (and that 'hostname' on the command line returns the
> same thing!).
>
> Then look at the settings table.
> mysql> select * from settings;
> and
> mysql> select * from settings [where hostname="correcthostname"];
>
> If you get 750 records and 300 records respectively, you have some work to do!
>
> You may have active entries under the hostname 'localhost' too. So you cannot just delete ALL the 'incorrect' settings without checking that
> there is a correct duplicate value entry. Most of the 'localhost' entries can be/should be set to your hostname. But don't mess with the 'NULL'
> entries.
>
> You can use:
> select value, data, count( value) from settings group by value having count(value) > 1 ;
> to find duplicate instances of 'value' in settings
> Similar calls will give duplicates in other tables.
>
> Beyond that, the hostname is also a field in the following tables:
>   capturecard
>   displayprofilegroups
>   housekeeping
>   inuseprograms
>   jobqueuea
>   jumppoints
>   keybindings
>   livestream
>   music_playlists
>   profilegroups
>   recordedartwork
>   recordedfile
>   recorded
>   scannerpath
>   storagegroup
>   tvchain
>   weatherscreens
>   weathersourcesettings
>
> Having duplicate hostname rows in most of these tables is innocuous as only the 'correct' entries will be in use. You can easily do a 'delete
> from ... where hostname="wrong";' in those tables.
>
> But you will have to check to see if items with the 'wrong' hostname' in the recorded* tables are actually visible in 'Watch Recordings'. You
> may hange those entries, and find that you have more recorded shows than you thought!
>
> You *may* want to do backups at intermediate stages and proceed carefully.

Hi,

I respectfully disagree. There are also tables with a column name of 'host',
so the list is longer.

You can do the above, with as many backups as you like. If a problem shows up
immediately, you're lucky and a restore gets you up and running. That also
assumes that any problems are identifiable either in operation or in the logs.

If you're not lucky, a problem occurs days/weeks/years later and you likely
have forgotten about what was done plus the backups created at the time are
useless. Or, maybe a future upgrade changes a table that was missed or had
rows incorrectly deleted and the update process fails.

I'd suggest leaving well enough alone. Your computer, your choice...

Ah, what Raymond said (define the need.)

-- 
Bill


More information about the mythtv-users mailing list