<p dir="ltr">Stunnel should remove it on abnormal exit. It's customary. See here <a href="http://stackoverflow.com/questions/688343/reference-for-proper-handling-of-pid-file-on-unix">http://stackoverflow.com/questions/688343/reference-for-proper-handling-of-pid-file-on-unix</a></p>

<div class="gmail_quote">On May 28, 2014 5:48 PM,  <<a href="mailto:reg14@rambler.ru">reg14@rambler.ru</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 28/May/2014 at 21:51:42 +0200, Jochen Bern wrote:<br>
> On 29.05.2014 00:58, <a href="mailto:reg14@rambler.ru">reg14@rambler.ru</a> wrote:<br>
> > It seems that it tries to create pidfile in /var/run, and ignores that<br>
> > the file is already exists. As a result, pid is not written to<br>
> > stunnel.pid, and daemon crashes. Could this be fixed?<br>
><br>
> You might want to note that PID files are *supposed* to *not* exist if<br>
> the software in question is not currently running. Try creating a<br>
> *subdirectory* that the user has sufficient rights for, and have stunnel<br>
> put the PID file there.<br>
<br>
I did this way and discovered that stunnel does not remove pidfile on<br>
stopping if it has received SIGHUP during its session. PID does not<br>
change, stop is successful, but pidfile is not removed. Then it becomes<br>
impossible to determine whether stunnel is running or not. So reloading<br>
configuration makes a mess. I think that truncating pidfile in an init.d<br>
script is more reliable sign that service is stoped as compared with<br>
deleting pidfile. init.d sctipts are probably the more appropriate place<br>
to manipulate pidfile. All that a daemon should do is to create pidfile<br>
if it does not exist.<br>
_______________________________________________<br>
stunnel-users mailing list<br>
<a href="mailto:stunnel-users@stunnel.org">stunnel-users@stunnel.org</a><br>
<a href="https://www.stunnel.org/cgi-bin/mailman/listinfo/stunnel-users" target="_blank">https://www.stunnel.org/cgi-bin/mailman/listinfo/stunnel-users</a><br>
</blockquote></div>