[systemd-devel] serializing execution of units

Ivan Shapovalov intelfx100 at gmail.com
Wed Jul 2 08:09:04 PDT 2014


On Wednesday 02 July 2014 at 18:04:36, Mantas Mikulėnas wrote:	
> On Wed, Jul 2, 2014 at 4:05 PM, Ivan Shapovalov <intelfx100 at gmail.com> wrote:
> > Consider the following situation.
> > We have foo.target and foo at .service. All instances of foo at .service are
> > WantedBy=foo.target (and implicitly After=foo.target). So, when foo.target
> > is activated, all instances of foo at .service are started in parallel.
> >
> > The question is -- how to run them sequentially?
> 
> You can't do this with systemd features (and I'm curious why this
> would be needed in the first place). But the program itself, or a
> wrapper script, could use flock() or the `flock` tool on a shared
> lockfile to serialize startup.

That's a good idea. I'll use wrapper+flock, thanks.

/*
The templated unit invokes `bup index` on a given path (bup is a tool for
doing incremental backups). Running multiple instances of `bup index` is
bogus, as they will end up overwriting the index file.
*/

-- 
Ivan Shapovalov / intelfx /
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 213 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140702/9fc83b5b/attachment.sig>


More information about the systemd-devel mailing list