Systemd – using the “+” prefix with ExecStartPre

systemd

According to systemd's service 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).

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

I've 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 ideal.

Best Answer

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

Related Question