<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><br>
</p>
<div class="moz-cite-prefix">On 1/27/19 11:20 AM, Tim Pletcher
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CABBGYbEcbtsFSMcTQwxfiqshfRM6WOFcdJ762kj4v+Yfkt-dHw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div dir="ltr">
<div>On Sun, Jan 27, 2019 at 6:36 AM James Abernathy
<<a href="mailto:jfabernathy@gmail.com"
moz-do-not-send="true">jfabernathy@gmail.com</a>>
wrote:<br>
</div>
</div>
</div>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">When I upgraded from
v29.1 to v30 I got a question during the upgrade <br>
that asked about the cron.weekly job mythtv-database. It
asked about <br>
keeping the current one or installing the packager
maintained one. For <br>
some reason I decided replace mine with the packager's
maintained one. I <br>
wasn't concerned since I've been using a different daily
script to <br>
check, optimize and backup mythconverg.<br>
<br>
So Sunday morning early I see and error:<br>
<br>
/etc/cron.weekly/mythtv-database:<br>
/etc/cron.weekly/mythtv-database: 17:
/etc/cron.weekly/mythtv-database: USER: parameter not set<br>
run-parts: /etc/cron.weekly/mythtv-database exited with
return code 2<br>
<br>
I'm not sure if this is problem for others. I see this
error because all <br>
cron and anacron errors and messages are emailed to me.<br>
</blockquote>
<div><br>
</div>
<div>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. </div>
<div><br>
</div>
<div>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.</div>
</div>
</div>
</div>
</blockquote>
<p><br>
</p>
<p>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.</p>
<p>I'll continue by deleting that file all together and use my daily
backup and optimize system that's worked for sometime.</p>
<p>Jim A</p>
<p><br>
</p>
<blockquote type="cite"
cite="mid:CABBGYbEcbtsFSMcTQwxfiqshfRM6WOFcdJ762kj4v+Yfkt-dHw@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<div><b>old file:</b></div>
<div>
<div>
<div>#!/bin/sh</div>
<div># /etc/cron.weekly/mythtv-database script - check
and backup mythconverg tables</div>
<div># Copyright 2005/12/02 2006/10/08 Paul Andreassen</div>
<div># 2010 Mario Limonciello</div>
<div>set -e -u</div>
<div>DBNAME="mythconverg"</div>
<div>DEBIAN="--defaults-extra-file=/etc/mysql/debian.cnf"</div>
<div>/usr/bin/mysqlcheck $DEBIAN -s $DBNAME</div>
<div>/usr/share/mythtv/<a
href="http://mythconverg_backup.pl"
moz-do-not-send="true">mythconverg_backup.pl</a></div>
<div>/usr/bin/logger -p <a href="http://daemon.info"
moz-do-not-send="true">daemon.info</a> -i -t${0##*/}
"$DBNAME checked and backed up."</div>
<div># End of file.</div>
</div>
<div><br>
</div>
<div><b>new file:</b></div>
<div>
<div>#!/bin/sh</div>
<div># /etc/cron.weekly/mythtv-database script - check
and backup mythconverg tables</div>
<div># Copyright 2005/12/02 2006/10/08 Paul Andreassen</div>
<div># 2010 Mario Limonciello</div>
</div>
<div>set -e -u</div>
<div>DBNAME="mythconverg"</div>
<div>DEBIAN="--defaults-extra-file=/etc/mysql/debian.cnf"</div>
<div>/usr/bin/mysqlcheck $DEBIAN -s $DBNAME</div>
<div>if [ -e "/etc/default/mythtv-backend" ]; then</div>
<div> . /etc/default/mythtv-backend</div>
<div>fi</div>
<div>if [ "$USER" = "" ]; then</div>
<div> CMDPREFIX=""</div>
<div>else</div>
<div> CMDPREFIX="sudo -u $USER"</div>
<div>fi</div>
<div>$CMDPREFIX /usr/share/mythtv/<a
href="http://mythconverg_backup.pl"
moz-do-not-send="true">mythconverg_backup.pl</a></div>
<div>/usr/bin/logger -p <a href="http://daemon.info"
moz-do-not-send="true">daemon.info</a> -i -t${0##*/}
"$DBNAME checked and backed up."</div>
<div># End of file.</div>
</div>
<div><br>
</div>
<div>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.</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
mythtv-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mythtv-users@mythtv.org">mythtv-users@mythtv.org</a>
<a class="moz-txt-link-freetext" href="http://lists.mythtv.org/mailman/listinfo/mythtv-users">http://lists.mythtv.org/mailman/listinfo/mythtv-users</a>
<a class="moz-txt-link-freetext" href="http://wiki.mythtv.org/Mailing_List_etiquette">http://wiki.mythtv.org/Mailing_List_etiquette</a>
MythTV Forums: <a class="moz-txt-link-freetext" href="https://forum.mythtv.org">https://forum.mythtv.org</a>
</pre>
</blockquote>
</body>
</html>