Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Mar 2009 14:23:34 -0800
From:      Doug Barton <dougb@FreeBSD.org>
To:        Artis Caune <artis.caune@gmail.com>
Cc:        ports@freebsd.org, stable@freebsd.org
Subject:   Re: restart a script in etc/rc.d
Message-ID:  <49AC5C66.70301@FreeBSD.org>
In-Reply-To: <9e20d71e0903021410i26ca8088oc2de76009b2773d2@mail.gmail.com>
References:  <20090302163843.cc66c55e.lehmann@ans-netz.de>	 <alpine.BSF.2.00.0903021100190.59723@qbhto.arg>	 <20090302202520.eaf09b15.lehmann@ans-netz.de>	 <9e20d71e0903021355i3ad66b8fx14bdc3b395e311a5@mail.gmail.com> <9e20d71e0903021410i26ca8088oc2de76009b2773d2@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Artis Caune wrote:
> 2009/3/2 Artis Caune <artis.caune@gmail.com>:
>> 2009/3/2 Oliver Lehmann <lehmann@ans-netz.de>:
>>> root@nudel rc.d> grep bacula_fd /etc/rc.conf
>>> bacula_fd_enable="YES"
>>> bacula_fd2_enable="YES"
>>> bacula_fd2_flags=" -u root -g wheel -v -c /usr/local/etc/bacula-fd2.conf"
>>> bacula_fd2_pidfile="/var/run/bacula-fd.9104.pid"
>> can you try with:
>>    bacula_fd_pidfile="/var/run/bacula-fd.9102.pid"
>> in /etc/rc.conf ?
> 
> 
> There is logic error in bacula rc.d script. It should first set
> default variables and only then use them.
>     pidfile="${bacula_fd_pidfile}"
>     : ${bacula_fd_pidfile="/var/run/bacula-fd.9102.pid"}
> 
> If you don't set pidfile in rc.conf, pidfile is "" so it kills all bacula-fd's

Yes, I tried to convince the OP to fix this, but he thought he had it
covered, so I'm giving him the opportunity to prove me wrong. :)
You've correctly identified what I believe to be the issue however.
(Namely that there is a disconnect between the variable "pidfile"
which is used throughout rc.subr, and ${name}_pidfile which has to be
assigned to $pidfile properly in the rc.d script or it won't work.)

I have "on my list" making this pidfile assignment internal to rc.subr
and therefore removing one more bullet from the foot-shooting gun, but
that would only help people who have the latest version of rc.subr,
which means that even if I fix it today we will still have to support
properly setting pidfile in the scripts for years (and versions of
FreeBSD) to come. Thus it's in the "less urgent" category.

Another potential solution would be to rewrite rc.subr to prefer
${name}_pidfile in all cases where it is defined, but then you still
have the backwards compatibility issue to deal with.


Doug

-- 

    This .signature sanitized for your protection



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?49AC5C66.70301>