Ticket #309 (closed defect: fixed)

Opened 12 years ago

Last modified 11 years ago

Desync auto-update by editing /etc/cron.d/debathena-auto-update instead of sleeping

Reported by: andersk Owned by:
Priority: normal Milestone: Summer 2010 (Lucid Deploy)
Component: -- Keywords:
Cc: Fixed in version:
Upstream bug:

Description

We’ve discovered that on recent Ubuntu, sleeping for extended periods inside a cron job can interfere with shutting down or restarting the machine through the GUI, because it claims that other users are logged in. This is not as important for -cluster but may be annoying to some -workstation users (or anyone else that decides to use our auto-updater).

geofft found  LP:284229, which is not related to anything except in that it mentions
“The use of pam-ck-connector means that consolekit registers a session for every cron or ssh session started.”
which partially explains the issue.

We could background the job, but we would lose cron’s job management and error reporting. Furthermore, it is a nice feature that it warns you about shutting down or restarting while an update is running.

So instead I think we should make the postinst edit a random hour-mod-2 and minute into /etc/cron.d/debathena-auto-update, and get rid of the sleep.

Change History

comment:1 Changed 12 years ago by ghudson

Another option is to run the auto-update job more frequently, and use desync's -t flag. In this scheme of things, the cron job would exit unless it is "time to run" according to a randomly selected time recorded in a file.

comment:2 Changed 12 years ago by jdreed

  • Milestone set to IAP 2010

comment:3 Changed 12 years ago by broder

For the record, I know that other packages do this, but shipping a file and then immediately and unconditionally re-writing it in the postinst bothers me. If we're going to go the dynamic-generation approach, I'd rather we /didn't/ ship the file in the package, and generated it from scratch in the postinst.

comment:4 Changed 12 years ago by jdreed

  • Milestone changed from Karmic Deploy to Spring 2010

comment:5 Changed 12 years ago by jdreed

Using desync -t seems like a simpler fix, since the auto-updater already depends on debathena-desync.

comment:6 Changed 12 years ago by jdreed

  • Milestone changed from Spring 2010 to Summer 2010 (Lucid Deploy)

comment:7 Changed 11 years ago by jdreed

  • Status changed from new to proposed

Do this with at(1) instead because it's fun to tempt fate.

comment:8 Changed 11 years ago by jdreed

This causes Cron to generate mail every time the job is run, because at insists on printing something like this :

warning: commands will be executed using /bin/sh
job 16 at Thu Apr 22 14:07:00 2010

So this needs to be, e.g.

bash -c echo "zwrite -d jdreed" | at "now + 1 minutes" 2> /dev/null

But I'm not sure I like the idea of throwing stderr away...

comment:9 follow-up: ↓ 10 Changed 11 years ago by jdreed

er, s/zwrite -d jdreed/athena-auto-update cron/

comment:10 in reply to: ↑ 9 Changed 11 years ago by andersk

Replying to jdreed:

bash -c echo "athena-auto-update cron" | at "now + 1 minutes" 2> /dev/null

That bash -c is irrelevant (also, -c takes a single argument); there are no bashisms in that command.

By the way, the package should depend on cron and at.

comment:11 Changed 11 years ago by broder

  • Status changed from proposed to closed
  • Resolution set to fixed
Note: See TracTickets for help on using tickets.