> On 01/13/2016 10:51 AM, Steve Dickson wrote: >> Hello, >> >> Is is possible to set a variable in the [Unit] >> section of a service? >> >> For example in rpc-gssd.service there is >> ConditionPathExists=/etc/krb5.keytab >> >> but for some installation the krb5.keytab >> is in a different place. The rpc.gssd daemon >> can be told this by setting a command line >> argument from the EnvironmentFile. >> >> So people have to edit both the EnvironmentFile >> and the rpc-gssd.service to make this change. >> >> So it would be nice if only the EnvironmentFile >> need to be edit and the change would happen >> in both places. >> >> Possible? >> >> steved.
I'm sorry I'm not responding to the original mail, as I just subscribed yesterday to this list. I am not sure I fully understand what you want, but I think this might do it: [Unit] Description=test [Service] Type=oneshot Environment=TEST=blah EnvironmentFile=-/etc/systemd/system/test-env ExecStart=/etc/systemd/system/test ${TEST} TimeoutSec=0 RemainAfterExit=yes The /etc/systemd/system/test is a script that prints $1, depending on what is being passed to it. When env file is not present, it prints the TEST from the unit file. When env file is present, and TEST is set to something else, it prints its value. Is that what you are looking for? Cheers
signature.asc
Description: OpenPGP digital signature
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel