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

Ian Barton lists at manor-farm.org
Tue Nov 17 07:20:24 UTC 2009


Michael T. Dean wrote:
> 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
> 
>

I'll just put in a plug from automysqlbackup from 
http://sourceforge.net/projects/automysqlbackup/

"A script to take daily, weekly and monthly backups of your MySQL 
databases using mysqldump. Features - Backup mutiple databases - Single 
backup file or to a seperate file for each DB - Compress backup files - 
Backup remote servers - E-mail logs - More.."


Worked faultlessly here for several years. It does rotation of backups 
and has saved me several times over the years:)

Ian.


More information about the mythtv-users mailing list