[Pm-utils] Making cron run after resume?

Victor Lowther victor.lowther at gmail.com
Sat May 10 21:30:02 PDT 2008

On Sun, 2008-05-11 at 00:46 +0200, Stefan Seyfried wrote:
> Victor Lowther wrote:
> > How about the following hook-running convention:
> > 
> > When running hooks in normal sort order, hooks shall run in two phases:
> > 
> > Phase 1: All hooks that DO NOT begin with two leading digits shall run
> > first (in no guaranteed order), and the success or failure of these
> > hooks SHALL be ignored by the pm-utils framework.
> > 
> > Phase 2: All hooks that DO begin with two leading digits shall run
> > second (in C-locale lexical sort order), and unexpected failure of these
> > hooks SHALL prevent pm-utils from suspending or hibernating the box.
> - breaking backwards compatibility

I assume you are referring to the attempted failure handling thing?
Yes, it does break backwards compatibility, but it is better than our
strategy of "hope that none of the hooks that failed was trying to work
around a bug that will cause data loss" or something equally nasty.

If you are referring to the two-phase thing, that only breaks
compatibility if you are currently running hooks without numeric
prefixes, otherwise it is just new functionality.

> - how do you tell the user why the machine did not suspend?

I don't have an answer for that. Currently, the only way pm-utils has of
telling the user anything is through the log -- I would be glad to
accept a patch that lets us communicate more status than just an exit
code to whatever framework called us, and let that framework (hal or
g-p-m or whatever) take appropriate action.

> > This neatly seperates out hooks that are run because an installed
> > program wants to do something automatically across a suspend/resume (but
> > that do not work around glitches that may cause suspend/resume to fail),
> > and hooks that must be run in a specific order to work around glitches
> > that may cause suspend to fail.
> Could you please give a specific use case?

The cron/anacron thing being discussed in this thread.  It should be
kicked off after we are fully up and runnning on resume, but other than
that it does not have a strict ordering dependency or fix a bug that
could otherwise result in a failed resume.

Network Manager and ntpd handling also fall into the same category.

Victor Lowther
Ubuntu Certified Professional

More information about the Pm-utils mailing list