[systemd-devel] Errant error message when starting a service?

Lee Duncan lduncan at suse.com
Mon Nov 30 08:51:35 PST 2015


Hi:

I have a service I've created, and it has a command that starts it (one
shot) and then two commands it tries to run after starting.

The oneshot command I want run is run correctly, but the two optional
startup commands, both prefaced with a minus sign ("-"), are not
present. Something like this example service file:

--------->> service file: leeman.service <<--------------
[Unit]
Description="Lee's test service"

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c "echo Service Starting ..."
ExecStartPost=-/usr/bin/no_such_program_1
ExecStartPost=-/usr/bin/no_such_program_2

ExecStop=/bin/bash -c "echo Service Stopping ..."

[Install]
WantedBy=sysinit.target
-------------->> end of service file <<------------------

When I manually start this example service, I see:

> zsh# systemctl status leeman
> leeman.service - "Lee's test service"
>    Loaded: loaded (/usr/lib/systemd/system/leeman.service; disabled)
>    Active: active (exited) since Mon 2015-11-30 08:46:55 PST; 7min ago
>  Main PID: 2549 (code=exited, status=0/SUCCESS)
> 
> Nov 30 08:46:55 linux-s2 bash[2549]: Service Starting ...
> Nov 30 08:46:55 linux-s2 systemd[2554]: Failed at step EXEC spawning /usr/bin/no_such_program_2: No such file or directory

So why is "no_such_program_2" showing up in the error message, but I
don't see anything aboutt "no_such_program_1"?

It turns out that if I have several "ExecStartPost=-MISSING_COMMAND"
lines, only the first one is silent.

Is this by design?

I've looked through the source code quite a bit but I have not gotten
far enough to detect what is different between the first run of an
optional post-start command and the rest. Any suggestions would be most
helpful.

Thank you.
-- 
Lee Duncan



More information about the systemd-devel mailing list