[systemd-devel] multiple instance template variable

Thomas Schreiber tom at rizu.mu
Thu Jan 3 12:23:11 PST 2013


Hi,

I've followed this example with success: http://superuser.com/a/393429/77086

However, I am trying to do one more variable substitution by altering the
path to the executable used by ExecStart:

# cat /usr/lib/systemd/system/uwsgi at .service
[Unit]
Description=uWSGI service for %i
After=syslog.target

[Service]
ExecStart=/srv/.virtualenvs/%i/bin/uwsgi --ini /etc/uwsgi/%i.ini
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT
Restart=always
Type=simple

[Install]
WantedBy=multi-user.target

# systemctl status uwsgi at myproject
uwsgi at myproject.service - uWSGI service for myproject
      Loaded: loaded (/usr/lib/systemd/system/uwsgi at .service; enabled)
      Active: failed (Result: start-limit) since Thu, 2013-01-03 14:01:31
CST; 4s ago
     Process: 23921 ExecStart=/srv/.virtualenvs/%i/bin/uwsgi --ini
/etc/uwsgi/%i.ini (code=exited, status=203/EXEC)
      CGroup: name=systemd:/system/uwsgi at .service/myproject

systemd[1]: Started uWSGI service for myproject.
systemd[1]: uwsgi at myproject.service: main process exited, code=exited,
status=203/EXEC
systemd[1]: Unit uwsgi at myproject.service entered failed state
systemd[1]: Stopping uWSGI service for myproject...
systemd[1]: Starting uWSGI service for myproject...
systemd[1]: Failed to start uWSGI service for myproject.
systemd[1]: Unit uwsgi at myproject.service entered failed state

# cat /etc/issue
Arch Linux \r (\l)

# uname -a
Linux noufos 3.6.10-1-ARCH #1 SMP PREEMPT Tue Dec 11 09:40:17 CET 2012
x86_64 GNU/Linux

# systemctl --version
systemd 196
arch
+PAM -LIBWRAP -AUDIT -SELINUX -IMA -SYSVINIT +LIBCRYPTSETUP +GCRYPT +ACL +XZ

Everything in this script works except the first %i variable on the
ExecStart line because I can get the service to start correctly simply by
hardcoding the path to the uwsgi executable:

     ExecStart=/srv/.virtualenvs/myproject/bin/uwsgi --ini /etc/uwsgi/%i.ini

So I am wondering if this is a bug or intentional behavior. Alternative
suggestions to using the template appreciated.

Thanks,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130103/9dd0e093/attachment.html>


More information about the systemd-devel mailing list