On development machines I often start services with onestart (e.g. /usr/local/etc/rc.d apache22 onestart). I do not set rcvar for these services, because I only require them for testing and development. The appended fix makes sure that the rc commands are executed without rcvar set if the service is running. This ensures the execution of the stop_cmd during system shutdown and makes the status and stop commands work without the one or force prefix. I have so far not stumbled over any problems caused by this.
Responsible Changed From-To: freebsd-bugs->freebsd-rc Over to maintainer(s)
I've been using that for a month, now and it solves more problems for me than I actually had in mind without causing any problems. I really want to see this committed. Is there any reason not to do so?
ping Please commit or close. I've been using this patch for 6 months now. Consider it very well tested. It stops postgres, apache and my vpnc connections upon shutdown. Especially that is useful, because if they are not shutdown properly I'm not allowed to log back in for 30 minutes.
Here is an improved version of the patch, that simply skips checkyesno ${rcvar} if the process is running. This way, each running service will be treated as if <service>_enable="YES" is set, which ensures proper shutdown treatment and generally more convenient handling or services. diff -u rc.subr.orig rc.subr --- rc.subr.orig 2010-04-10 11:09:28.000000000 +0200 +++ rc.subr 2010-04-10 11:21:06.000000000 +0200 @@ -660,12 +660,12 @@ if [ "$_elem" != "$rc_arg" ]; then continue fi - # if ${rcvar} is set, and $1 is not - # "rcvar", then run + # if ${rcvar} is set, $1 is not "rcvar" + # and ${rc_pid} is not set, then run # checkyesno ${rcvar} # and return if that failed # - if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then + if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a -z "${rc_pid}" ]; then if ! checkyesno ${rcvar}; then if [ -n "${rc_quiet}" ]; then return 0
Author: dougb Date: Thu Apr 15 21:18:24 2010 New Revision: 206686 URL: http://svn.freebsd.org/changeset/base/206686 Log: If a service is running, make 'stop' work even if ${name}_enable is not set. PR: conf/130414 Submitted by: Dominic Fandrey <kamikaze@bsdforen.de> Reviewed by: freebsd-rc@ Modified: head/etc/rc.subr Modified: head/etc/rc.subr ============================================================================== --- head/etc/rc.subr Thu Apr 15 20:48:57 2010 (r206685) +++ head/etc/rc.subr Thu Apr 15 21:18:24 2010 (r206686) @@ -646,12 +646,12 @@ run_rc_command() if [ "$_elem" != "$rc_arg" ]; then continue fi - # if ${rcvar} is set, and $1 is not - # "rcvar", then run + # if ${rcvar} is set, $1 is not "rcvar" + # and ${rc_pid} is not set, then run # checkyesno ${rcvar} # and return if that failed # - if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then + if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" -a -z "${rc_pid}" ]; then if ! checkyesno ${rcvar}; then if [ -n "${rc_quiet}" ]; then return 0 _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
State Changed From-To: open->patched The change has been committed to HEAD. I will MFC it after it has had time to settle, but ideally before 8.1-RELEASE.
Responsible Changed From-To: freebsd-rc->dougb I'll handle the MFC.
I'm really glad this is progressing, thank you very much!
State Changed From-To: patched->closed This has now been merged to RELENG_[78], I'm not going to merge it to RELENG_6 for 2 reasons, the most important being that there will not be a new release on that branch and we'd like to encourage folks to move on. The other reason is that merging it to RELENG_7 required merging another, very old (2008) change that was worth merging anyway, but is a degree of complexity that we usually try to avoid in the older branches. Meanwhile, thanks again both for this suggestion, the patch, and perhaps more importantly, your persistence. :) Regards, Doug