[systemd-devel] Quick ? about ExecStartPre and Restart

Paul D. DeRocco pderocco at ix.netcom.com
Wed Jul 3 15:38:55 PDT 2013


I'm new to systemd, and I'm confused about something. The docs include the
following sentence under the Restart directive:

"Configures whether the service shall be restarted when the service process
exits, is killed, or a timeout is reached. The service process may be the
main service process, but also one of the processes specified with
ExecStartPre=, ExecStartPost=, ExecStopPre=, ExecStopPost=, or ExecReload=."

Read literally, this suggests that if I set this to "on-success" or
"always", and I have an ExecStartPre that runs a quick command (in my case,
to copy my main service executable from a flash drive to a RAM drive), then
as soon as that completes, systemd will say, "Hey, the service has
terminated, time to restart it" and never get around to the ExecStart that
really does the work.

Is that really true? Or is that just a mistake in the docs? If it's not a
mistake, how do I configure it so that it won't restart when the command
launched by ExecStartPre terminates with a 0 exit code, but will restart if
the actual service started by ExecStart terminates with a 0 exit code?

Or is there another preferable way to do this?

-- 

Ciao,               Paul D. DeRocco
Paul                mailto:pderocco at ix.netcom.com 
 



More information about the systemd-devel mailing list