Opened 2 years ago

Closed 19 months ago

#12964 closed Bug Report - General (fixed)

run-parts: /etc/cron.weekly/mythtv-database exited with return code 2

Reported by: bart@… Owned by: pressy <bart@…>
Priority: minor Milestone: unknown
Component: Packaging Version: 0.28.0
Severity: medium Keywords:
Cc: Ticket locked: no

Description

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

Change History (3)

comment:1 Changed 22 months ago by Peter Bennett

Component: MythTV - GeneralPackaging

comment:2 Changed 19 months ago by Peter Bennett

comment:3 Changed 19 months ago by pressy <bart@…>

Owner: set to pressy <bart@…>
Resolution: fixed
Status: newclosed

In 5cda06807ec4cc7f2383653f946443f38ec59ffc/packaging:

Fix for weekly databaase backup failing

Fixes #12964

Merge remote-tracking branch 'lwt-pressy/master'

Signed-off-by: Peter Bennett <pbennett@…>

Note: See TracTickets for help on using tickets.