Search the web
Sign In
New User? Sign Up
FreeBSD-rc · Improving FreeBSD startup scripts
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Fixing faststop - Checked by AntiVir DEMO version -   Message List  
Reply | Forward Message #726 of 729 |
Hi folks,

I'm not sure if the fast prefix was intended to also work with
the stop command, but I think it should. The reason is because
most applications don't clean up their pid file when they shut
down, so if I shutdown(8) from single-user I get a lot of:
xxx not running? (check pidfile)
which is annoying and makes the os seem "unpolished."
So, the attached patch tries to fix that by making the stop
command simply exit (withoug displaying any messages) if
it tried looking for a running program and could not find it,
and rc_fast is set.

Note, that in order to make it work I had to change the
way the _pidcmd is evaluated. It is evaluated unconditionally
now. The check for the existence of rc_fast happens later for
the start command.

Note that you may still get that error for ports because they
use a copy of rc.subr under /usr/local and not the base system
rc.subr (That's another problem, but if you follow -arch you
know I'm trying to get that fixed as well).

Cheers.
--
Mike Makonnen | GPG-KEY: http://www.identd.net/~mtm/mtm.asc
mtm@... | Fingerprint: AC7B 5672 2D11 F4D0 EBF8 5279 5359 2B82 7CD4 1F55
mtm@...| FreeBSD - Unleash the Daemon !


Wed Mar 3, 2004 3:07 pm

mike_makonnen
Offline Offline
Send Email Send Email

Index: etc/rc.shutdown
===================================================================
RCS file: /home/ncvs/src/etc/rc.shutdown,v
retrieving revision 1.25
diff -u -r1.25 rc.shutdown
--- etc/rc.shutdown 8 Jul 2003 02:52:14 -0000 1.25
+++ etc/rc.shutdown 3 Mar 2004 13:31:45 -0000
@@ -85,8 +85,8 @@
files=`eval grep -l \'^# KEYWORD:.*FreeBSD\' \`rcorder -k shutdown /etc/rc.d/*
2>/dev/null\``

for _rc_elem in `reverse_list $files`; do
- debug "run_rc_script $_rc_elem stop"
- run_rc_script $_rc_elem stop
+ debug "run_rc_script $_rc_elem faststop"
+ run_rc_script $_rc_elem faststop
done

# Terminate the background watchdog timer (if it is running)
Index: etc/rc.subr
===================================================================
RCS file: /home/ncvs/src/etc/rc.subr,v
retrieving revision 1.24
diff -u -r1.24 rc.subr
--- etc/rc.subr 27 Feb 2004 09:58:50 -0000 1.24
+++ etc/rc.subr 3 Mar 2004 17:02:28 -0000
@@ -493,7 +493,7 @@
_procname=${procname:-${command}}

# setup pid check command if not fast
- if [ -z "$rc_fast" -a -n "$_procname" ]; then
+ if [ -n "$_procname" ]; then
if [ -n "$pidfile" ]; then
_pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname
$command_interpreter"')'
else
@@ -586,7 +586,7 @@
;;

start)
- if [ -n "$rc_pid" ]; then
+ if [ -z "$rc_fast" -a -n "$rc_pid" ]; then
echo "${name} already running? (pid=$rc_pid)."
exit 1
fi
@@ -671,6 +671,7 @@

stop)
if [ -z "$rc_pid" ]; then
+ [ -n "$rc_fast" ] && exit 0
if [ -n "$pidfile" ]; then
echo \
"${name} not running? (check $pidfile)."


Forward
Message #726 of 729 |
Expand Messages Author Sort by Date

Hi folks, I'm not sure if the fast prefix was intended to also work with the stop command, but I think it should. The reason is because most applications don't...
Mike Makonnen
mike_makonnen
Offline Send Email
Mar 3, 2004
3:20 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help