[mythtv-users] Cleanup script

Leighton Brough brough at baremetalsoft.com
Wed Oct 11 01:57:06 UTC 2006


Michael T. Dean wrote:
> On 10/10/06 14:15, George Nassas wrote:
>
>   
>> On 9-Oct-06, at 9:23 PM, Monkey Pet wrote:
>>
>>     
>>> I was wondering if their is a script to do the  
>>> following: compare NUV files with entries in the db and make sure  
>>> it exists on both ends (files and db).  If they don't, take the  
>>> proper action.  I want to accomplish two things.  Free up space by  
>>> getting rid of rouge files.  Also cleanup the db, so I don't have  
>>> to manually delete a bunch of entries using the frontend.  Anyways  
>>> if this doesn't exist, I will just write it myself.
>>>    
>>>
>>>       
>> The other half - removing db rows for entries that have no matching  
>> files is trickier. You can't know if a file is truly missing or if  
>> it's on remote storage and temporarily unavailable.
>>
>>     
> But, assuming you have no remote storage (or you know it's accessible), 
> you can just scroll through the list of recordings in Watch Recordings 
> (with the live preview enabled) and if you get just blackness, it's 
> probably non-existent.  Or, you can tail -f the mythfrontend log while 
> you're scrolling and when you see the error about a non-existent file, 
> you know you need to delete it.
>   
Is there a easy way to find files which _do_ exist, but don't have 
corresponding entries in the database? In this case they'll be wasting 
storage, and will never be expired.

An example of when this could happen is after the restore of the myth 
database, when recordings have happened since the backup. In my case, 
this can occur if I roll-back to a backup of my myth system, because I 
realise after a few days that an update has broken something important. 
Since I don't backup the actual recordings (for obvious space reasons), 
just the rest of the system, it's possible for recording files to exist 
which aren't in the database. My current solution is to include the 
output of 'ls -lR' in the backup, so I can manually compare and cleanup, 
but an easier way would be nice.

Leighton


More information about the mythtv-users mailing list