[mythtv-commits] Ticket #12964: run-parts: /etc/cron.weekly/mythtv-database exited with return code 2
MythTV
noreply at mythtv.org
Sun Dec 25 15:34:05 UTC 2016
#12964: run-parts: /etc/cron.weekly/mythtv-database exited with return code 2
--------------------------------------+---------------------
Reporter: bart@… | Owner:
Type: Bug Report - General | Status: new
Priority: minor | Milestone: unknown
Component: MythTV - General | Version: 0.28.0
Severity: medium | Keywords:
Ticket locked: 0 |
--------------------------------------+---------------------
The mythtv backup scripts exists with error code 2 and does no backup if
root has an .my.cnf file for mysqldump with different user.
The reason is already described in then code of "mythconverg_backup.pl":
{{{
verbose($verbose_level_debug,
'', "Attempting to use supplied password for $mysqldump.",
'Any [client] or [mysqldump] password specified in the
MySQL'.
' options file will',
'take precedence.');
}}}
By reading the /etc/default/mythtv-backend file and using sudo if the
mythv user is set,this could be solved:
{{{
#!/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
/usr/bin/logger -p daemon.info -i -t${0##*/} "$DBNAME checked and backed
up."
# End of file.
}}}
the changed code is:
{{{
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
}}}
--
Ticket URL: <https://code.mythtv.org/trac/ticket/12964>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list