[mythtv-users] Putting the mythconverg_backup.pl in a cron job

Michael T. Dean mtdean at thirdcontact.com
Mon Nov 16 19:41:06 UTC 2009


On 11/16/2009 12:22 PM, Harry Devine wrote:
> On 11/16/2009 12:10 PM, Mike Holden wrote:
>> Harry Devine wrote:
>>   
>>> OK, so I want put the new mythconverg_backup.pl into a cron job, but 
>>> I'm
>>> not having much success.  I can run it from the command line and it 
>>> runs
>>> fine, however, when I put it into a cron job, it never runs.  I created
>>> a script called mythdb_backup under /cron/cron.daily as follows:
>>>
>>> #!/bin/sh
>>> mythconverg_backup.pl --rotate 7
>>>
>>> Pretty basic, but it never runs.  How can I debug why its not running?
>>> I didn't see anything in /var/log/messages, but I may be looking in the
>>> wrong area.
>>>      
>> Put the full path to the script in your crontab. The cron environment 
>> is a cut-down
>> version of what you get when you log in, and not all the elements of 
>> your $PATH are
>> avaiulable in your cron config.
>>    
> Thanks for the tip.  I just made the change so I guess I'll find out 
> tomorrow morning if it worked or not.  Eventually I'd like to have it 
> automatically SCP the file to another machine on my network, but for 
> now, this is good enough. 

Also, note that you /must/ have a valid HOME environment variable set 
that refers to a HOME with a $HOME/.mythtv/config.xml and, really, 
should have a $HOME/.mythtv/backuprc with at least a DBBackupDirectory 
specified.

As a matter of fact, you probably want to do:

echo "rotate=7" >> $HOME/.mythtv/backuprc

so you don't run the backup script from the command-line without the 
--rotate 7 and accidentally delete a couple of old backups.  Then your 
cron job command line becomes just:

mythconverg_backup.pl

Mike


More information about the mythtv-users mailing list