From owner-freebsd-ports Mon Jul 3 5:46:22 2000 Delivered-To: freebsd-ports@freebsd.org Received: from cip1.melaten.rwth-aachen.de (cip1.melaten.RWTH-Aachen.DE [134.130.92.100]) by hub.freebsd.org (Postfix) with ESMTP id 8A98337B835 for ; Mon, 3 Jul 2000 05:46:11 -0700 (PDT) (envelope-from tg@melaten.rwth-aachen.de) Received: from cip12.melaten.rwth-aachen.de (cip12.melaten.rwth-aachen.de [134.130.92.12]) by cip1.melaten.rwth-aachen.de (8.9.3/8.8.8) with ESMTP id NAA15893 for ; Mon, 3 Jul 2000 13:48:51 +0200 Received: (from tg@localhost) by cip12.melaten.rwth-aachen.de (8.9.3/8.9.3) id OAA35023; Mon, 3 Jul 2000 14:58:38 +0200 (CEST) (envelope-from tg@melaten.rwth-aachen.de) X-Authentication-Warning: cip12.melaten.rwth-aachen.de: tg set sender to tg@melaten.rwth-aachen.de using -f To: freebsd-ports@FreeBSD.org Subject: /etc/rc.shutdown From: Thomas Gellekum Date: 03 Jul 2000 14:58:37 +0200 Message-ID: Lines: 37 User-Agent: Gnus/5.0805 (Gnus v5.8.5) XEmacs/21.1 (Canyonlands) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --=-=-= 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 ; 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