On Tue, 26.07.11 09:28, Honza Horak ([email protected]) wrote: > Hi, > > I wonder if a name of service can be accessed in service file somehow? > > Let's have the following script (e.g. part of a former SysV init script): > > thisname=`basename $0` > . /etc/$thisname > > If I'd like to create the same behavior in systemd, e.g.: > > EnvironmentFile=/etc/${thisname} > > Is it possible? > > It would be useful for many services to know its name, because if we > create a new service using > cp /lib/systemd/system/foo.service etc/systemd/system/bar.service, > we need to change the configuration file by hand always, which is > really easy to forget and make some problems unnecessarily.
Why would you copy a unit like this? If you want to make changes to a unit file I recommend copying it from /lib to /etc and edit it there, but that while keeping the same filename. Why would you want top copy a file and rename it? What's your usecase (I don't doubt there is one, I am just curious). (But yeah, as you noticed %n is what you are looking for.) Lennart -- Lennart Poettering - Red Hat, Inc. _______________________________________________ systemd-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/systemd-devel
