postpone
 cb | debian | bridge | irc | df7cb | projects  

Description

Postpone schedules a command to be executed later when a lockfile disappears. Intended usage is when a command is executed possibly multiple times, but running once is sufficient. This happens in maintainer scripts of Debian packages: for example, the menu system will need to run update-menus every time a menu file is installed or removed, but if several packages are processed at once, a single update-menus run at the end is sufficient. In fact, postpone is a generalization of similar code found in update-menus that is already able to postpone itself. Another prominent use case are TeX packages that need to rebuild several indices.

On startup, postpone will look if any of the lock files given with --wait exists. If not, it will run command immediately in foreground. Otherwise, it will fork to background, waiting for the lock file(s) to disappear. At the same time, the --lock file is created to indicate to other postpone instances that command is already scheduled for execution; the other instances will exit without further action.

Additionally, --extra-lock will be acquired just before the execution of command, this allows the serialization of several (different) background jobs.

All lockfiles are optional.

Manpage

Example

Postpone applied to texlive-lang - installing all texlive-lang packages takes over 4 minutes on my machine without postpone, and only 1 minute (35s for dpkg -i plus 25s for the background jobs) with postpone built into the post* scripts, using a modified tex-common package.

Download

 
 Christoph Berg | Page last changed Sun Jun 10 21:43:48 2007 CET