[systemd-devel] Multiple template parameters for one service

Alexander Vladimirov alexander.idkfa.vladimirov at gmail.com
Sat Jun 28 09:21:33 PDT 2014


You could just use /etc/systemd/system/unison at instance.service.d/
directory to provide service environment variables, this seems to be
much more convenient way to configure service.

Best regards,
Alexander


2014-06-29 0:15 GMT+08:00 Moviuro <moviuro at gmail.com>:
> Hi all,
>
> I am at the moment trying to clean up my units to write some simple ones that
> I just have to link without hardcoding anything in them but am stuck at this
> issue: what to do if my unit requires multiple parameters?
>
> E.g. Using unison to sync files, the different variables I have to use are:
> local user and profile file (an optional variable would be the server). It is
> at the moment not possible to write a unit file that would understand so many
> things with just a simple '@'.
> I could use an extra configuration file in /etc/systemd/system every time I
> want to use unison, but it's not really nice and clean (one file per unison
> profile...).
> Some people would object that I can have a bash script do the job of
> translating what is behind the '@' into my many arguments: not really nice
> either.
>
> An idea would be to use units with many '@' or have systemd interpret the
> string between '@' and '.service' as '@'-separated values (e.g.
> unison at local_user@profile.service).
>
> The feature could also help by including some optional arguments (e.g. the
> server information in unison is not necessary for it to work but could help if
> I use a service to check if the server is online beforehand:
> unison at local_user@profile at server.service).
>
> Cheers,
> --
> Moviuro
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
>


More information about the systemd-devel mailing list