Hi, I've below etc/rc.d bacula-fd and I copied it to bacula-fd2 because I need to run 2 file daemons. I'Ve modified every variable for the 2nd start script to be independent from the first one. It works so far but when I issue etc/rc.d/bacula-fd restart it also stops the process started by bacula-fd2 probably because + _find_processes /usr/local/sbin/bacula-fd . -ax gets executed or whatever. Is there a way in the rc.d scope to define to only look for the pid in the pid file (why do we have them anyway when we search everytime) and only kill the PID listed in the pid file? root@nudel olivleh1> cat /var/run/bacula-fd.910 bacula-fd.9102.pid bacula-fd.9104.pid root@nudel olivleh1> cat /var/run/bacula-fd.910* 33076 33125 root@nudel olivleh1> ps auxww | grep bacula-fd | grep -v SsJ root 33076 0.0 0.4 8160 2980 ?? Ss 4:31PM 0:00.02 /usr/local/sbin/bacula-fd -u root -g wheel -v -c /usr/local/etc/bacula-fd.conf root 33125 0.0 0.4 8160 2980 ?? Ss 4:35PM 0:00.01 /usr/local/sbin/bacula-fd -u root -g wheel -v -c /usr/local/etc/bacula-fd2.conf root@nudel olivleh1> /usr/local/etc/rc.d/bacula-fd restart Stopping bacula_fd. Starting bacula_fd. root@nudel olivleh1> ps auxww | grep bacula-fd | grep -v SsJ root 33151 0.4 0.4 7136 2968 ?? Ss 4:36PM 0:00.01 /usr/local/sbin/bacula-fd -u root -g wheel -v -c /usr/local/etc/bacula-fd.conf root@nudel olivleh1> /usr/local/etc/rc.d/bacula-fd2 restart bacula_fd2 not running? (check /var/run/bacula-fd.9104.pid). Starting bacula_fd2. root@nudel olivleh1> ps auxww | grep bacula-fd | grep -v SsJ root 33170 0.5 0.4 7136 2968 ?? Ss 4:36PM 0:00.01 /usr/local/sbin/bacula-fd -u root -g wheel -v -c /usr/local/etc/bacula-fd2.conf root 33151 0.0 0.4 7136 2968 ?? Ss 4:36PM 0:00.01 /usr/local/sbin/bacula-fd -u root -g wheel -v -c /usr/local/etc/bacula-fd.conf -- Oliver Lehmann http://www.pofo.de/ http://wishlist.ans-netz.de/
Hi Doug, Doug Barton wrote:> Also, the assignment of pidfile should really come after the defaults are > set. > > If you do all that and it still doesn't work, send a diff of your two rc.d > scripts to the list.PROVIDE is in both cases "utility" (probably a generic unchanged default) - I've changed it to utility2 for bacula-fd2 with no changes. Here the diff: root@nudel rc.d> diff -u bacula-fd* --- bacula-fd 2009-02-15 23:25:03.000000000 +0100 +++ bacula-fd2 2009-03-02 20:22:40.000000000 +0100 @@ -16,16 +16,16 @@ . /etc/rc.subr -name="bacula_fd" +name="bacula_fd2" rcvar=${name}_enable command=/usr/local/sbin/bacula-fd load_rc_config $name -pidfile="${bacula_fd_pidfile}" +pidfile="${bacula_fd2_pidfile}" -: ${bacula_fd_enable="NO"} -: ${bacula_fd_flags=" -u root -g wheel -v -c /usr/local/etc/bacula-fd.conf"} -: ${bacula_fd_pidfile="/var/run/bacula-fd.9102.pid"} +: ${bacula_fd2_enable="NO"} +: ${bacula_fd2_flags=" -u root -g wheel -v -c /usr/local/etc/bacula-fd2.conf"} +: ${bacula_fd2_pidfile="/var/run/bacula-fd.9104.pid"} run_rc_command "$1" Exit 1 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" root@nudel rc.d> -- Oliver Lehmann http://www.pofo.de/ http://wishlist.ans-netz.de/
On Mon, 2 Mar 2009, Oliver Lehmann wrote:> Hi, > > I've below etc/rc.d bacula-fd and I copied it to bacula-fd2 because I > need to run 2 file daemons. > I'Ve modified every variable for the 2nd start script to be independent > from the first one. > It works so far but when I issue etc/rc.d/bacula-fd restart it also stops > the process started by bacula-fd2 probably because > > + _find_processes /usr/local/sbin/bacula-fd . -ax > > gets executed or whatever. > > Is there a way in the rc.d scope to define to only look for the pid in > the pid file (why do we have them anyway when we search everytime) and > only kill the PID listed in the pid file?Well that is certainly how it is supposed to work, and that script defines pidfile which should prevent it from doing what you're suggesting. So let's check your work. :) To accomplish what you want you would have to change all of the following in your duplicate script: 1. filename (IOW, you need 2 scripts with different names) 2. PROVIDE 3. name4. rcvar= (If you redefine $name that should be enough) 5. pidfile6. The names of the variables in the default assignments Also, the assignment of pidfile should really come after the defaults are set. If you do all that and it still doesn't work, send a diff of your two rc.d scripts to the list. hope this helps, Doug -- This .signature sanitized for your protection
Oliver Lehmann wrote:> Doug Barton writes: >> You missed the bit where I said that this should come after the >> assignment of the defaults below. > > Ok, but... >> Have you confirmed that the two pid files exist, and that they contain >> the right information? > > Yes they both exists (probably because I define the variable in rc.conf > too). See my initial mail where I cat the contents of both files - they > both contain the right PID for their specific process. > So - where is the problem now?Do this: script bacula-fd2.log sh -x /usr/local/etc/rc.d/bacula-fd2 restart If the log is not too long, send it to the list. If it is, gzip it first. Doug -- This .signature sanitized for your protection