3

According to documentation, a + may be used as a prefix in systemd service configurations.

I am trying to use it like this:

[Service]
ExecStartPre=+/usr/bin/tomcat1
Type=simple
Environment="NAME=tomcat1"
EnvironmentFile=/etc/sysconfig/tomcat1
ExecStart=/usr/libexec/tomcat/server start
SuccessExitStatus=143
User=tomcat
Group=tomcat

I want to run /usr/bin/tomcat1 with elevated privileges, but doing so with the "+" sign gives the following error (note, "-" does not give an error).

"systemd1: [/usr/lib/systemd/system/tomcat1.service:10] Executable path is not absolute, ignoring: +/usr/bin/tomcat1"

Ive also tried ExecStartPre="+/usr/bin/tomcat1, ExecStartPre="+"/usr/bin/tomcat1, etc.

I know I can use PermissionsStartOnly=true as an alternative, which should work, but that seemed less than idea.

3

The documentation that you are using does not match the version of systemd that you are using. The "+" modifier was introduced in version 231.

  • 1
    Yea this seems to be the case, the installed version is 219. Thanks for confirmation with the version #. – Brozovelt Dec 19 '17 at 15:45
1

It seems like the documentation I was using as reference may be inaccurate or out of date (perhaps support for +, !, etc was removed). Running man systemd.service server side seems to only mention "-". It would be great if anyone could confirm this, however.

  • I see it being used with ExecStart not ExecStartPre in that manual link – George Udosen Dec 18 '17 at 21:31
  • I thought that might be the case at first as well, however, right after the table it states "Note that these prefixes are also supported for the other command line settings, i.e. ExecStartPre=, ExecStartPost=, ExecReload, ExecStop= and ExecStopPost=." – Brozovelt Dec 18 '17 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.