[mythtv-users] DBbackups

Phill Edwards philledwards at gmail.com
Sat Dec 24 03:40:17 UTC 2016


Greetings Mythizens, I'm looking for an elegant way to backup my database
> not only to the standard location /mythtv/DBbackups but also to a separate
> always on PC. Right now i can access it through the "connect to server"
> option in Ubuntu "files".
> Myth runs on one Ubuntu machine FE/BE and wakes up for recordings, I have
> a gigabit LAN (cat5 between the two boxes) with the primary
> Ubuntu/ZoneMinder box running 24/7. What are my options?
>
>
Here's my mythconverg database backup script which runs nightly from cron:


#
---------------------------------------------------------------------------------------------------
# Script that executes mythconverg_backup.pl to export
# mythconverg database, save it, compress it and
# rotate our old backup files on local disk. Then latest backup file is
# copied from local disk off to NAS.
# This is called from phill's crontab.
#
# Run as user phill as backuprc file for mythconverg_backup.pl lives in
/home/phill/.mythtv/
#
# To Do:
#    - Rotate files off NAS so they don't keep building up and up.
#
---------------------------------------------------------------------------------------------------


### Step 1) Run mythconverg database backup script.
/usr/share/mythtv/mythconverg_backup.pl --verbose


### Step 2) Copy database backups off server onto NAS
SRC_DIR=/mnt/xvdb1/dbbackups
DEST_DIR=/mnt/nas/Backup/VirtualMachines/MBE3-MythUbu-14.04-64bit/dbbackups-KEEP

# Check if backup directory is available (mounted)
if [ ! -d $DEST_DIR ]; then
        echo "ERR: Backup folder $DEST_DIR is not accessible."
        exit 1
fi

# Copy the most recent backup file
FNAME=`ls -t /mnt/xvdb1/dbbackups/ | /usr/bin/head -1`
echo "`date` DBG: Copying $SRC_DIR/$FNAME to $DEST_DIR..."
cp $SRC_DIR/$FNAME $DEST_DIR/

### Exit cleanly with no error
exit 0


And here's my backuprc in /home/phill/.mythtv


# mythconverg_backup.pl resource file used by backup/restore scripts
# Run /usr/share/mythtv/mythconverg_backup.pl --help --help to
# see explanation of options.

DBBackupDirectory=/mnt/xvdb1/dbbackups
rotate=7
mysqldump=/usr/bin/mysqldump
compress=/bin/gzip

#DBHostName
#DBPort
#DBUserName
#DBPassword
#DBName
#DBSchemaVer
#DBBackupFilename
#rotateglob
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20161224/9dabb7b7/attachment.html>


More information about the mythtv-users mailing list