On 11/29/2013 12:59 AM, Mantas Mikulėnas wrote:
>> > In a trial presentation I used the following service file:
>> > [Unit]
>> > Description=Virtual Distributed Ethernet
>> > After=syslog.target
>> >
>> > [Service]
>> > Type=forking
>> > PIDFile=/var/run/vde.pid
>> > # Note the -f: don't fail if there is no PID file
>> > ExecStartPre=/bin/rm -f /var/run/vde.pid
>> > ExecStart=/usr/bin/vde_switch --tap tap0 --mode 0660 \
>> > --dirmode 0750 --group qemu \
>> > --daemon --pidfile /var/run/vde.pid
>> > Restart=on-abort
>> >
>> > [Install]
>> > WantedBy=multi-user.target
>> >
>> > Here the PID file is removed before the service is started.
>> >
>> > This brought up two questions.
>> > - What happens is you start a service that you already started?
>> Nothing, or is the service first stopped and then again started?
>>
>> 'systemctl start' only starts services, therefore it will do nothing if
>> the service is already started.
>>
>> 'systemctl restart' would stop it and start it again.
>>
>> > - What happens if someone started the service manually? So bypassing
>> systemd and running directly /usr/bin/vde_switch.
>>
>> As far as systemd is concerned, nothing happens - the manually started
>> vde_switch is just another process inside your login session. It will
>> *not* be automatically pulled into a "service" just because the program
>> name or something happens to match...
>
>
> I should learn to ask my questions better. T_T
>
> What I mend to ask. Someone starts /usr/bin/vde_switch manually and
after that uses systemctl to start it.
>
If the second vde_switch instance is configured to listen on the same
sockets, etc., then... Well, it depends on the daemon itself:
* most will consider this a fatal error, and exit with non-zero status,
causing the systemd .service to fail as well;
* 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.)
I don't know how vde behaves. It will probably refuse to start.
The best way to find out, of course, is to try systemd yourself.
I need only a generic answer. So if this question is asked I can answer
with it depends on the service. Making sure that when they ask further I
remember your explanation.
Thanks.
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel