<p dir="ltr">On Nov 29, 2013 1:36 AM, "Cecil Westerhof" <<a href="mailto:Cecil.Westerhof@snow.nl">Cecil.Westerhof@snow.nl</a>> wrote:<br>
><br>
> Thanks for the speedy reply.<br>
><br>
><br>
> On 11/29/2013 12:30 AM, Mantas Mikulėnas wrote:<br>
>><br>
>> On Nov 29, 2013 1:24 AM, "Cecil Westerhof" <<a href="mailto:Cecil.Westerhof@snow.nl">Cecil.Westerhof@snow.nl</a><br>
>> <mailto:<a href="mailto:Cecil.Westerhof@snow.nl">Cecil.Westerhof@snow.nl</a>>> wrote:<br>
>> ><br>
>> > In a trial presentation I used the following service file:<br>
>> > [Unit]<br>
>> > Description=Virtual Distributed Ethernet<br>
>> > After=syslog.target<br>
>> ><br>
>> > [Service]<br>
>> > Type=forking<br>
>> > PIDFile=/var/run/vde.pid<br>
>> > # Note the -f: don't fail if there is no PID file<br>
>> > ExecStartPre=/bin/rm -f /var/run/vde.pid<br>
>> > ExecStart=/usr/bin/vde_switch --tap tap0 --mode 0660 \<br>
>> > --dirmode 0750 --group qemu \<br>
>> > --daemon --pidfile /var/run/vde.pid<br>
>> > Restart=on-abort<br>
>> ><br>
>> > [Install]<br>
>> > WantedBy=multi-user.target<br>
>> ><br>
>> > Here the PID file is removed before the service is started.<br>
>> ><br>
>> > This brought up two questions.<br>
>> > - What happens is you start a service that you already started?<br>
>> Nothing, or is the service first stopped and then again started?<br>
>><br>
>> 'systemctl start' only starts services, therefore it will do nothing if<br>
>> the service is already started.<br>
>><br>
>> 'systemctl restart' would stop it and start it again.<br>
>><br>
>> > - What happens if someone started the service manually? So bypassing<br>
>> systemd and running directly /usr/bin/vde_switch.<br>
>><br>
>> As far as systemd is concerned, nothing happens - the manually started<br>
>> vde_switch is just another process inside your login session. It will<br>
>> *not* be automatically pulled into a "service" just because the program<br>
>> name or something happens to match...<br>
><br>
><br>
> I should learn to ask my questions better. T_T<br>
><br>
> What I mend to ask. Someone starts /usr/bin/vde_switch manually and after that uses systemctl to start it.<br>
></p>
<p dir="ltr">If the second vde_switch instance is configured to listen on the same sockets, etc., then... Well, it depends on the daemon itself:</p>
<p dir="ltr">* most will consider this a fatal error, and exit with non-zero status, causing the systemd .service to fail as well;</p>
<p dir="ltr">* but some will think that the existing socket is stale, will remove it, and happily start "on top of" the first instance. (Only happens with Unix sockets, of course; if the daemon uses TCP or tries to grab the same 'tap0' interface or such, then it can only fail.)</p>
<p dir="ltr">I don't know how vde behaves. It will probably refuse to start.</p>
<p dir="ltr">The best way to find out, of course, is to try systemd yourself.</p>