Re: restart a script in etc/rc.d
Oliver Lehmann wrote: Doug Barton wrote: Artis Caune wrote: 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. :) Yeah this did it - Its working now. I thought you where just telling me that to have another pidfile for the 2nd start script - I missed the point that it was empty for the first one and because of that it is falling back to ps... I'll probably write a PR and commit it after aproval for PROVIDE and the pidfile setting... Excellent. :) Doug -- This .signature sanitized for your protection ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
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: r...@nudel rc.d diff -u bacula-fd* --- bacula-fd 2009-02-15 23:25:03.0 +0100 +++ bacula-fd2 2009-03-02 20:22:40.0 +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 r...@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 r...@nudel rc.d -- Oliver Lehmann http://www.pofo.de/ http://wishlist.ans-netz.de/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
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. name= 4. rcvar= (If you redefine $name that should be enough) 5. pidfile= 6. 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 ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
Oliver Lehmann wrote: 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: That's arguably a bug. It should be something more descriptive. The standard is that the name of the script file, the $name variable and the PROVIDE line should all match. r...@nudel rc.d diff -u bacula-fd* --- bacula-fd 2009-02-15 23:25:03.0 +0100 +++ bacula-fd2 2009-03-02 20:22:40.0 +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} You missed the bit where I said that this should come after the assignment of the defaults below. -: ${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 r...@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 Have you confirmed that the two pid files exist, and that they contain the right information? Doug -- This .signature sanitized for your protection ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
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? ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
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 ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
On Mon, Mar 2, 2009 at 4:10 PM, Glen Barber glen.j.bar...@gmail.com wrote: On Mon, Mar 2, 2009 at 2:25 PM, Oliver Lehmann lehm...@ans-netz.de wrote: 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: r...@nudel rc.d diff -u bacula-fd* --- bacula-fd 2009-02-15 23:25:03.0 +0100 +++ bacula-fd2 2009-03-02 20:22:40.0 +0100 @@ -16,16 +16,16 @@ . /etc/rc.subr -name=bacula_fd +name=bacula_fd2 rcvar=${name}_enable command=/usr/local/sbin/bacula-fd I didn't see anyone else mention this -- did you change 'bacula-fd' to 'bacula-fd2'? Actually... That may not work (although, you could create a symlink, but I doubt that'll help). Ignore my noise. -- Glen Barber ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
On Mon, Mar 2, 2009 at 2:25 PM, Oliver Lehmann lehm...@ans-netz.de wrote: 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: r...@nudel rc.d diff -u bacula-fd* --- bacula-fd 2009-02-15 23:25:03.0 +0100 +++ bacula-fd2 2009-03-02 20:22:40.0 +0100 @@ -16,16 +16,16 @@ . /etc/rc.subr -name=bacula_fd +name=bacula_fd2 rcvar=${name}_enable command=/usr/local/sbin/bacula-fd I didn't see anyone else mention this -- did you change 'bacula-fd' to 'bacula-fd2'? -- Glen Barber ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
2009/3/2 Artis Caune artis.ca...@gmail.com: 2009/3/2 Oliver Lehmann lehm...@ans-netz.de: r...@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 -- regards, Artis Caune . CCNA | BSDA | ' didii FreeBSD ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
Artis Caune wrote: 2009/3/2 Artis Caune artis.ca...@gmail.com: 2009/3/2 Oliver Lehmann lehm...@ans-netz.de: r...@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 ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
2009/3/2 Oliver Lehmann lehm...@ans-netz.de: r...@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 ? -- regards, Artis Caune . CCNA | BSDA | ' didii FreeBSD ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org
Re: restart a script in etc/rc.d
Doug Barton wrote: Artis Caune wrote: 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. :) Yeah this did it - Its working now. I thought you where just telling me that to have another pidfile for the 2nd start script - I missed the point that it was empty for the first one and because of that it is falling back to ps... I'll probably write a PR and commit it after aproval for PROVIDE and the pidfile setting... -- Oliver Lehmann http://www.pofo.de/ http://wishlist.ans-netz.de/ ___ freebsd-stable@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-stable To unsubscribe, send any mail to freebsd-stable-unsubscr...@freebsd.org