From 5e58125da8781c14ae12a6422046f6102ba4ee3d Mon Sep 17 00:00:00 2001 From: mtm Date: Sat, 26 Jun 2004 09:27:30 +0000 Subject: Make the stop command respect the 'fast' prefix. Most notably, this cleans up messages when shutting down from single user. In such a case there are usually no daemons running, but their pid files are still in /var/run. This causes rc.d to output diagnostics about daemons with pidfiles, but that are not running. --- etc/rc.shutdown | 4 ++-- etc/rc.subr | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'etc') diff --git a/etc/rc.shutdown b/etc/rc.shutdown index 5555f7d..fa00feb 100644 --- a/etc/rc.shutdown +++ b/etc/rc.shutdown @@ -85,8 +85,8 @@ fi 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) diff --git a/etc/rc.subr b/etc/rc.subr index 2d879e6..349daee 100644 --- a/etc/rc.subr +++ b/etc/rc.subr @@ -492,8 +492,8 @@ run_rc_command() _pidcmd= _procname=${procname:-${command}} - # setup pid check command if not fast - if [ -z "$rc_fast" -a -n "$_procname" ]; then + # setup pid check command + if [ -n "$_procname" ]; then if [ -n "$pidfile" ]; then _pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')' else @@ -586,7 +586,7 @@ run_rc_command() ;; 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 @@ $command $rc_flags $command_args" stop) if [ -z "$rc_pid" ]; then + [ -n "$rc_fast" ] && exit 0 if [ -n "$pidfile" ]; then echo \ "${name} not running? (check $pidfile)." -- cgit v1.1