Re: [systemd-devel] how-to run instantiated units from templates one after the other

2015-09-21 Thread David Herrmann
Hi

On Fri, Sep 18, 2015 at 8:34 PM, Dmitry Karpov  wrote:
> I have a template for creating the backup:
>
> backup@.service
>
> [Unit]
>
> Description=Instance %i
>
> [Service]
>
> ExecStart=/bin/sh -c "echo do backup job for %i"
>
> [Install]
>
> WantedBy=maintenance.target
>
> and some target:
>
> maintenance.target
>
> [Unit]
>
> Description=target for maintenance
>
> StopWhenUnneeded=yes
>
> As can be seen, instances from backup@ start with maintenance.target. But
> they run in parallel.
>
> There is some way to run them one after the other?
>
> I thought that specifying Conflicts=backup@*.service in the template should
> lead to this, but it is not.

Wildmasks are not supported. Furthermore, your logic would make the
unit conflict with itself, which I doubt is what you want. You should
implement such logic in your own tool instead of pushing it into
unit-files. For instance, if you don't need parallelism, why use
multiple units at all? Just make a single unit iterate over all
devices.

Thanks
David
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] how-to run instantiated units from templates one after the other

2015-09-21 Thread Ian Geiser
I have a similar problem, but from what I can tell with the current 
templates this is not possible.  I ended up using an internal script 
that would loop over the process.


On 09/18/2015 02:34 PM, Dmitry Karpov wrote:

I have a template for creating the backup:

backup@.service

[Unit]

Description=Instance %i

[Service]

ExecStart=/bin/sh -c "echo do backup job for %i"

[Install]

WantedBy=maintenance.target

and some target:

maintenance.target

[Unit]

Description=target for maintenance

StopWhenUnneeded=yes

As can be seen, instances from backup@ start with maintenance.target.
But they run in parallel.

There is some way to run them one after the other?

I thought that specifying Conflicts=backup@*.service in the template
should lead to this, but it is not.



___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] how-to run instantiated units from templates one after the other

2015-09-18 Thread Dmitry Karpov
I have a template for creating the backup:

backup@.service

[Unit]

Description=Instance %i

[Service]

ExecStart=/bin/sh -c "echo do backup job for %i"

[Install]

WantedBy=maintenance.target

and some target:

maintenance.target

[Unit]

Description=target for maintenance

StopWhenUnneeded=yes 

As can be seen, instances from backup@ start with maintenance.target. But they 
run in parallel.

There is some way to run them one after the other?

I thought that specifying Conflicts=backup@*.service in the template should 
lead to this, but it is not.




smime.p7s
Description: S/MIME cryptographic signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel