cronjob for mythtv-status send's me many mails after upgrade to jaunty

Bug #379500 reported by Stefan Pappalardo
38
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Mythbuntu
Fix Released
Medium
Unassigned
mythtv-status (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: mythtv-status

Description: Ubuntu 9.04
Release: 9.04
mythtv-status:
  Installiert: 0.7.3-2ubuntu2
  Kandidat: 0.7.3-2ubuntu2
  Versions-Tabelle:
 *** 0.7.3-2ubuntu2 0
        500 http://de.archive.ubuntu.com jaunty/universe Packages
        100 /var/lib/dpkg/status

After upgrading to jaunty every ten minutes root becomes this electronic message:

Envelope-to: root@htpc
Delivery-date: Fri, 22 May 2009 20:00:02 +0200
From: Cron Daemon <root@htpc>
To: root@htpc
Subject: Cron <root@obelix> [ -x /etc/init.d/mythtv-status ] && /etc/init.d/mythtv-status reload > /dev/null
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/root>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=root>

mv: Aufruf von stat für „/var/run/motd.new“ nicht möglich: No such file or directory

ProblemType: Bug
Architecture: amd64
DistroRelease: Ubuntu 9.04
NonfreeKernelModules: nvidia
Package: mythtv-status 0.7.3-2ubuntu2
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=de_DE:de
 LANG=de_DE.UTF-8
 SHELL=/bin/bash
SourcePackage: mythtv-status
Uname: Linux 2.6.28-11-generic x86_64

Revision history for this message
Stefan Pappalardo (sjuk) wrote :
Revision history for this message
MarcRandolph (mrand) wrote :

Googling your error message results in the following hit:
http://v2kblog.blogspot.com/2009/05/upgrading-mythbuntu-from-810-to-904.html

which suggests the following work-around. Could you back up the below mentioned files and then try this solution?

This problem was caused by two cron jobs both trying to modify /etc/motd at the same time (every 10 minutes)! The update-motd cron job moves /var/run/motd.new out from underneath the mythtv-status job. You can see the two jobs in /etc/cron.d:
# grep 10 /etc/cron.d/mythtv-status /etc/cron.d/update-motd

/etc/cron.d/mythtv-status:*/10 * * * * root [ -x /etc/init.d/mythtv-status ] && /etc/init.d/mythtv-status reload > /dev/null
/etc/cron.d/update-motd:*/10 * * * * root [ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null

I believe what should really be happening is myth-status should be run by update-motd every 10 minutes instead of independently. Here is what I did to make that happen:

# rm /etc/cron.d/mythtv-status
# cd /etc/update-motd.d/
# ln -s /usr/bin/mythtv-status 50-mythtv-status

Changed in mythbuntu:
importance: Undecided → Medium
status: New → Confirmed
Revision history for this message
Stefan Pappalardo (sjuk) wrote :

I did the following...

1.) Testing if we have the same situation as in the workaround was discribed. => Yes we have.
$ grep 10 /etc/cron.d/mythtv-status /etc/cron.d/update-motd
/etc/cron.d/mythtv-status:*/10 * * * * root [ -x /etc/init.d/mythtv-status ] && /etc/init.d/mythtv-status reload > /dev/null
/etc/cron.d/update-motd:*/10 * * * * root [ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null

2.) Backing up the cronjob for mythtv-status. => It is now in the userhome.
$ sudo mv /etc/cron.d/mythtv-status ~/

3.) Adding mythtv-status to update-motd. => Workaround is in place.
$ cd /etc/update-motd.d/
$ sudo ln -s /usr/bin/mythtv-status 50-mythtv-status

4.) Activating the changes for cron. => Workaround is activated.
$ sudo /etc/init.d/cron restart

5.) Testing if Workaround does its job. => mythtv-status isn't in the crontable anymore.
$ grep 10 /etc/cron.d/mythtv-status /etc/cron.d/update-motd
grep: /etc/cron.d/mythtv-status: No such file or directory
      /etc/cron.d/update-motd:*/10 * * * * root [ -x /usr/sbin/update-motd ] && /usr/sbin/update-motd 2>/dev/null

6.) Waiting for ten minutes getting an E-Mail.
=> No E-Mail.

7.) Testing if mythtv-status does its job by "ssh mythbuntu-machine".
=> Everything all right.

Revision history for this message
MarcRandolph (mrand) wrote :

Thank you for verifying the fix.

Changed in mythbuntu:
status: Confirmed → Triaged
Revision history for this message
Mario Limonciello (superm1) wrote : Re: [Bug 379500] Re: cronjob for mythtv-status send's me many mails after upgrade to jaunty

It sounds like a good packaged workaround then might be to set up
mythtv-status to run every 11 minutes instead if it's common for other apps
to register on the 10 minute mark. How many would think to go on the 11 min
;)

2009/5/23 MarcRandolph <email address hidden>

> Thank you for verifying the fix.
>
> ** Changed in: mythbuntu
> Status: Confirmed => Triaged
>
> --
> cronjob for mythtv-status send's me many mails after upgrade to jaunty
> https://bugs.launchpad.net/bugs/379500
> You received this bug notification because you are a member of Mythbuntu
> Developers, which is subscribed to Mythbuntu.
>

--
Mario Limonciello
<email address hidden>

Revision history for this message
Stefan Pappalardo (sjuk) wrote :

Hello Mario,

It's a joke? Isn't it? Not that it is a good idea separating cronjobs by time to give a system more balance.
But I think most users prefer a fix, not a workaround.

If I got you wrong, please take my apalogize and forget my comment.

Revision history for this message
Andrew Ruthven (andrew-etc) wrote :

Hi,

As the mythtv-status author, my preferred solution is to have mythtv-status run via update-motd.

Just symlink'ing /usr/bin/mythtv-status into /etc/update-motd.d/ isn't the best solution - you won't pick up the configuration settings.

However, the next version of mythtv-status will use a stand along config file which it tries to load, and that'll allow a much cleaner solution to this.

In the meantime, the work around that Stefan gives is probably better (no need to restart cron though). Also, the latest version of mythtv-status (not in Ubuntu yet) checks if motd.new exists before it tries to move it in an attempt to reduce the race condition that is being hit.

Cheers!

Revision history for this message
MarcRandolph (mrand) wrote :

Thanks for the discussion and status update, Andrew!

Changed in mythtv-status (Ubuntu):
status: New → In Progress
Changed in mythbuntu:
status: Triaged → In Progress
Revision history for this message
tedder (launchpad-perljam) wrote :

I can confirm this in my upgrade too, and Andrew, thanks for working on it.

Revision history for this message
Will (will-berriss) wrote :

Rather than symlinking and not getting the config changes (e.g. $HOST, $EMAIL) why not just do the following:

cd /etc/cron.d/update-motd.d/
mv ../cron.daily/mythtv-status .

This way you'd get it to source the config, i.e. it does this . /etc/default/mythtv-status

Or rather you would if this method of mine worked, but it doesn't. :(

Oh well, shame, cos I'd like the email and host config to be used.

Should I just hard code these into /usr/bin/mythtv-status?

Revision history for this message
Stefan Pappalardo (sjuk) wrote :

For me an upgrade to karmic solved the Problem.

Revision history for this message
Mario Limonciello (superm1) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. However, I am closing it because the bug has been fixed in the latest stable version of Ubuntu - Karmic Koala. It won't be fixed in previous versions of Ubuntu because the package doesn't fit the requirements for backporting. See https://help.ubuntu.com/community/UbuntuBackports for more information.

Changed in mythbuntu:
status: In Progress → Fix Released
Changed in mythtv-status (Ubuntu):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.