[mythtv-users] mythtv v30 mythtv-database backup

James Abernathy jfabernathy at gmail.com
Tue Jan 29 12:55:59 UTC 2019


On 1/27/19 11:20 AM, Tim Pletcher wrote:
> On Sun, Jan 27, 2019 at 6:36 AM James Abernathy <jfabernathy at gmail.com 
> <mailto:jfabernathy at gmail.com>> wrote:
>
>     When I upgraded from v29.1 to v30 I got a question during the upgrade
>     that asked about the cron.weekly job mythtv-database. It asked about
>     keeping the current one or installing the packager maintained one.
>     For
>     some reason I decided replace mine with the packager's maintained
>     one. I
>     wasn't concerned since I've been using a different daily script to
>     check, optimize and backup mythconverg.
>
>     So Sunday morning early I see and error:
>
>     /etc/cron.weekly/mythtv-database:
>     /etc/cron.weekly/mythtv-database: 17:
>     /etc/cron.weekly/mythtv-database: USER: parameter not set
>     run-parts: /etc/cron.weekly/mythtv-database exited with return code 2
>
>     I'm not sure if this is problem for others. I see this error
>     because all
>     cron and anacron errors and messages are emailed to me.
>
>
> I had the same issue occur this morning with the cron.weekly job.  The 
> old file was not in /etc/cron.weekly but i have backups of the 
> original thanks to btrfs snapshotting.
>
> Comparing the two, the new cron job file has some logic that attempts 
> to set the $USER variable by reading out the 'mythtv-backend' file in 
> /etc/default if the file exists. I don't have this file in my 
> installation and the if/then/else fall-back logic doesn't seem to work 
> properly as it appears $USER isn't set to "" as expected if the file 
> doesn't exist.


I can't come up with a reason to have the backup run as $USER. Running 
as root guarantees that it will be run and if I have to restore I can 
always change the permission of one database backup file prior to the 
restore.

I'll continue by deleting that file all together and use my daily backup 
and optimize system that's worked for sometime.

Jim A


>
> *old file:*
> #!/bin/sh
> # /etc/cron.weekly/mythtv-database script - check and backup 
> mythconverg tables
> # Copyright 2005/12/02 2006/10/08 Paul Andreassen
> #                      2010 Mario Limonciello
> set -e -u
> DBNAME="mythconverg"
> DEBIAN="--defaults-extra-file=/etc/mysql/debian.cnf"
> /usr/bin/mysqlcheck $DEBIAN -s $DBNAME
> /usr/share/mythtv/mythconverg_backup.pl <http://mythconverg_backup.pl>
> /usr/bin/logger -p daemon.info <http://daemon.info> -i -t${0##*/} 
> "$DBNAME checked and backed up."
> # End of file.
>
> *new file:*
> #!/bin/sh
> # /etc/cron.weekly/mythtv-database script - check and backup 
> mythconverg tables
> # Copyright 2005/12/02 2006/10/08 Paul Andreassen
> #                      2010 Mario Limonciello
> set -e -u
> DBNAME="mythconverg"
> DEBIAN="--defaults-extra-file=/etc/mysql/debian.cnf"
> /usr/bin/mysqlcheck $DEBIAN -s $DBNAME
> if [ -e "/etc/default/mythtv-backend" ]; then
>    . /etc/default/mythtv-backend
> fi
> if [ "$USER" = "" ]; then
>    CMDPREFIX=""
> else
>    CMDPREFIX="sudo -u $USER"
> fi
> $CMDPREFIX /usr/share/mythtv/mythconverg_backup.pl 
> <http://mythconverg_backup.pl>
> /usr/bin/logger -p daemon.info <http://daemon.info> -i -t${0##*/} 
> "$DBNAME checked and backed up."
> # End of file.
>
> For now, I just added a new line to the new cron.weekly job that 
> explicitly sets user to mythtv which allows the cron job to complete. 
> I had never noticed before but the database backups made with the old 
> job are owned by root while the new ones are owned by mythtv which 
> makes sense and is probably preferred.
>
> _______________________________________________
> mythtv-users mailing list
> mythtv-users at mythtv.org
> http://lists.mythtv.org/mailman/listinfo/mythtv-users
> http://wiki.mythtv.org/Mailing_List_etiquette
> MythTV Forums: https://forum.mythtv.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20190129/0ab05d86/attachment.html>


More information about the mythtv-users mailing list