[systemd-devel] JobTimeout

Lennart Poettering lennart at poettering.net
Tue Mar 1 12:07:52 PST 2011


On Tue, 01.03.11 07:32, Andrey Borzenkov (arvidjaar at gmail.com) wrote:

> Could someone please give example of intended usage? I must admit I do
> not really understand it from reading documentation. Thank you!

JobTimeout= adds a timeout to jobs enqueued for a unit. If a job is
queued for longer than this timeout it is considered failed and removed
from the queue. This is useful at various places. Think .device units:
if we wait for a normal hw device there is nothing we can do to make it
appear, we completely depend on a user physically plugging it in or the
hw to finish initialization at boot. Hence there is no "starting" state
for .device units like there is for services -- there's only "plugged"
and "unplugged" and nothing in between. Now, for services we timeout the
"starting" state, to ensure that when a service gets stuck while
starting up we notice this, cancel it and fail the job. But if you wait
for a job this wouldn't work in lack of the "starting" state, hence the
only thing we can do instead is timeout the job, not the service. And
this is useful elsewhere too: consider something like "local-fs.target"
which waits for quite a few other things, but doesn't really do anything
by itself. JobTimeout is a way to add a global timeout for *everything*
local-fs.target is waiting for, over all its dependencies. The deps can
take as long as they want, but local-fs.target will only wait
JobTimeout= time for all of them.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list