restart a script in etc/rc.d

Doug Barton dougb at
Mon Mar 2 14:23:38 PST 2009

Artis Caune wrote:
> 2009/3/2 Artis Caune <artis.caune at>:
>> 2009/3/2 Oliver Lehmann <lehmann at>:
>>> root at 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/"
>> can you try with:
>>    bacula_fd_pidfile="/var/run/"
>> 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/"}
> 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.



    This .signature sanitized for your protection

More information about the freebsd-ports mailing list