[systemd-devel] Creating .service files for sets of similar services

Mantas Mikulėnas grawity at gmail.com
Fri Feb 26 14:14:34 UTC 2016


On Fri, Feb 26, 2016 at 3:06 PM, Terry Burton <tez at terryburton.co.uk> wrote:

> Hi,
>
> I have an application that in part consists of a number of instances
> of similar processes (each with their own configuration and bound to
> neighbouring ports, etc.)
>
> I could create a .service file for each instance from a template but
> I'm wondering whether systemd has some built-in way of handling this
> situation. Maybe something akin to generators but for services based
> on a template and with fewer early-boot requirements?
>
> Previously I had a single init script (init.d.fake/app-N) to which I
> pointed a symlink for each instance (e.g. init.d/app-5) and the init
> script would extract the instance number from $0. So only a single
> file to maintain. Systemd seems just a little more awkward.
>

https://www.freedesktop.org/software/systemd/man/systemd.unit.html – search
for "instance". You're looking for %i and the `app at .service` syntax.

-- 
Mantas Mikulėnas <grawity at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20160226/6010da4c/attachment.html>


More information about the systemd-devel mailing list