From owner-freebsd-ports@FreeBSD.ORG Mon Mar 2 22:23:38 2009 Return-Path: Delivered-To: ports@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4502B1065672 for ; Mon, 2 Mar 2009 22:23:38 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx22.fluidhosting.com [204.14.89.5]) by mx1.freebsd.org (Postfix) with ESMTP id DE3198FC2C for ; Mon, 2 Mar 2009 22:23:37 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: (qmail 26173 invoked by uid 399); 2 Mar 2009 22:23:33 -0000 Received: from localhost (HELO ?192.168.0.24?) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 2 Mar 2009 22:23:33 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <49AC5C66.70301@FreeBSD.org> Date: Mon, 02 Mar 2009 14:23:34 -0800 From: Doug Barton Organization: http://www.FreeBSD.org/ User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 To: Artis Caune References: <20090302163843.cc66c55e.lehmann@ans-netz.de> <20090302202520.eaf09b15.lehmann@ans-netz.de> <9e20d71e0903021355i3ad66b8fx14bdc3b395e311a5@mail.gmail.com> <9e20d71e0903021410i26ca8088oc2de76009b2773d2@mail.gmail.com> In-Reply-To: <9e20d71e0903021410i26ca8088oc2de76009b2773d2@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: ports@freebsd.org, stable@freebsd.org Subject: Re: restart a script in etc/rc.d X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Mar 2009 22:23:38 -0000 Artis Caune wrote: > 2009/3/2 Artis Caune : >> 2009/3/2 Oliver Lehmann : >>> 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