You could just use /etc/systemd/system/[email protected]/ 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 <[email protected]>: > 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@[email protected]). > > 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@local_user@[email protected]). > > Cheers, > -- > Moviuro > _______________________________________________ > systemd-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/systemd-devel > _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
