This question has probably been asked many times before, but I didn't 
see it mentioned anywhere on the systemd web site.

I want to create a unit file for a service where the server program
requires an argument or environment value that has to be computed at
run time; it isn't known in advance.  For example, suppose the server
requires the numeric UID value corresponding to some particular
username, passed as an argument or an environment value.

In a SysV-type shell script, I could simply do:

        exec /path/to/server_program `id -u username`

or

        export USERID=`id -u username`
        exec /path/to/server_program

Neither of these is possible in a systemd service unit file.  So what 
is the best way to accomplish the same result?

All I have been able to think of is to have ExecStart= run a shell 
script that computes the necessary values and then execs the actual 
server program.  Is there a better way?

Alan Stern

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

Reply via email to