[systemd-devel] Multiple starts of a service, what am I doing wrong?

Daniel Mack daniel at zonque.org
Wed Sep 30 03:12:22 PDT 2015


On 09/24/2015 03:27 PM, D.S. Ljungmark wrote:
> (re-send due to wrong email address)
> 
> On 24/09/15 14:38, Daniel Mack wrote:
>> On 09/24/2015 01:17 PM, D.S. Ljungmark wrote:
>>> I've got the following unit:
>>>
>>> [Unit]
>>> Description=Random Submitter
>>> Wants=network-online.target
>>> After=network-online.target other.service
>>> RequiresMountsFor=/data
>>>
>>> [Service]
>>> Type=simple
>>
>> Type=simple implies that the executable specified through ExecStart= is
>> the main process and that it does not fork but 'block'. Is that the
>> case? If it does fork, like most daemons do, Type= should be set to
>> 'forking'.
>>
>> Or do you actually want to run that binary just once, without systemd
>> restarting it after it died? That you should set Type= to 'oneshot'.
>>
>> See systemd.service(5) for more information.
> 
> 
> That is correct. ExecStartPre does some environment/Testing, while the
> actual submitter will run fpr ~20 hours, slowly doing network chatter,
> and abort in case of network error (trusting systemd to restart it)
> 
> So, it's a daemon that never forks.
> 
> The question I have isn't about this running or not (it runs
> beautifully, gets restarted when it should, and starts once it has a
> certificate available)

I see. So, that's just a cosmetic issue then, resulting in log messages
that shouldn't be there because the service is already started. We'll
look into that.

However, this can only happen when something modifies one of the
PathExists= files (/data/certificate.crt, /data/submitter.ini) on your
system. Does your daemon do that, or any other part of your setup? You
can also fix that by preventing those modifications.


Thanks,
Daniel



More information about the systemd-devel mailing list