Skip site navigation (1)Skip section navigation (2)
Date:      03 Jul 2000 14:58:37 +0200
From:      Thomas Gellekum <tg@melaten.rwth-aachen.de>
To:        freebsd-ports@FreeBSD.org
Subject:   /etc/rc.shutdown
Message-ID:  <kqd7kvxtdu.fsf@cip12.melaten.rwth-aachen.de>

next in thread | raw e-mail | index | archive | help
--=-=-=

Moin,

I will commit the attached snippet to /etc/rc.shutdown in -current and
-stable in a day or two along with changes to the rc.d scripts in the
ports that don't grok the `stop' argument currently. Basically, these
scripts will grow a case statement similar to

,----
| case "$1" in
| start)
|         # old startup script
|         ;;
| stop)
|         # killall <daemon>; or nothing
|         ;;
| *)
|         echo "Usage: `basename $0` {start|stop}" >&2
|         exit 64
|         ;;
| esac
| exit 0
`----

The return value (64) is taken from the 20 or so scripts that already
support this structure. Old scripts that already respond correctly to
`${script} stop' will not change.

There are also some scripts that hardcode $PREFIX (as /usr/local,
usually). This is a seperate issue; if someone has patches for this,
please commit them this night or wait until I'm done.

I'd appreciate it if someone would prepare a handbook entry on this.

tg


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=rc.shutdown.diff

--- /ad0/etc/rc.shutdown	Fri Dec  3 21:01:43 1999
+++ /etc/rc.shutdown	Mon Jul  3 11:18:35 2000
@@ -17,6 +17,15 @@
 PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
 export HOME PATH
 
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/rc.conf ]; then
+	. /etc/defaults/rc.conf
+	source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+	. /etc/rc.conf
+fi
+
 # Check if /var/db/mounttab is clean.
 case $1 in
 reboot)
@@ -28,8 +37,27 @@
 
 echo -n "Shutting down daemon processes: "
 
-# Insert shutdown procedures here
+# for each valid dir in $local_startup, search for init scripts matching *.sh
+case ${local_startup} in
+[Nn][Oo] | '')
+	;;
+*)
+	for dir in ${local_startup}; do
+		if [ -d "${dir}" ]; then
+			for script in ${dir}/*.sh; do
+				if [ -x "${script}" ]; then
+					(set -T
+					 trap 'exit 1' 2
+					 ${script} stop)
+				fi
+			done
+		fi
+	done
+	echo .
+	;;
+esac
 
+# Insert other shutdown procedures here
 
 echo '.'
 exit 0

--=-=-=--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?kqd7kvxtdu.fsf>