[systemd-devel] Multiple template parameters for one service

Moviuro moviuro at gmail.com
Sat Jun 28 09:15:58 PDT 2014


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20140628/666bb489/attachment.sig>


More information about the systemd-devel mailing list