/var/lib/dpkg/lock
Dpkg's default lockfile.
Schedules a command to be executed later when a lockfile disappears
postpone [-dfv]
[-lwLoO
FILE]
command
args ...
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. See below for examples.
-w FILE or --wait FILE
Wait for FILE before running command. Can be given several times. This activates the main feature of postpone -- delay execution until some other task has exited (specifically, released its fcntl() lock).
-l FILE or --lock FILE
Creates lockfile FILE. If postpone is called again with the same FILE, it will exit, assuming the task is already postponed. Make sure that the (effects of the) commands are the same for the same lockfile.
-L FILE or --extra-lock FILE
Before running command, acquire lock on FILE. Use this to serialize several (most likely different) postponed commands.
-d or --debian
Equivalent to --wait /var/lib/dpkg/lock --extra-lock /var/lib/dpkg/postpone.lock. Meant for use in maintainer scripts of Debian packages, will wait for dpkg and apt-get to exit and serialize the postponed commands.
-o FILE or --output FILE
Redirect stdout and stderr output to FILE when running in background. (Discarded otherwise.) If FILE ends with "XXXXXX", mkstemp is used.
-O FILE or --all-output FILE
Like --output, but always redirect stdout and stderr output to FILE.
-f or --foreground
Do not detach while waiting for locks.
-v or --verbose
Verbose output. Repeat for debugging output.
--help
Print options summary and exit.
--version
Print version information and exit.
--version-string
Print version information in machine readable form and exit.
Example usage in a texlive postinst maintainer script:
if [ -x /usr/bin/postpone ] ; then
postpone --verbose --lock /var/run/updmap-sys.lock --debian \
--all-output /tmp/updmap.XXXXXXXX \
updmap-sys
else
updmap-sys
fi
/var/lib/dpkg/lock
Dpkg's default lockfile.
/var/lib/dpkg/postpone.lock
Default extra lockfile when running with --debian.
For compatibility, using unknown options does not abort the program. Applications can use --version-string if they need to compare the postpone version number.
Unchanged in 3 releases since Debian 5.0 (Lenny).