Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jun 1998 22:21:36 +0200
From:      Ollivier Robert <roberto@keltia.freenix.fr>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: misc/6818: local_startup section of /etc/rc
Message-ID:  <19980602222136.A6541@keltia.freenix.fr>
In-Reply-To: <199806012110.OAA12752@freefall.freebsd.org>; from Jeff Aitken on Mon, Jun 01, 1998 at 02:10:01PM -0700
References:  <199806012110.OAA12752@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
[ redirected to -hackers ]

According to Jeff Aitken:
>  Is anyone (besides me ;-) interested in this sort of thing?  I'd be
>  happy to work on it, but only if anybody gives a damn.  I'm not

It is very easy with our current scheme to emulate almost all of the SYSV
behaviour (no run levels)...

I have the following on my machines :

/etc/init.d:
total 4
-rw-r--r--  1 root  wheel  188 Sep 25  1995 README
-rwxr-x---  1 root  wheel  359 Mar  7  1996 httpd.sh*
-rwxr-x---  1 root  wheel  411 Feb 22 12:47 news.sh*
-rwxr-x---  1 root  wheel  314 Feb 22 12:47 ssh.sh*

/etc/rc.d:
total 0
lrwx------  1 root  wheel  17 Sep  6  1997 90news.sh@ -> ../init.d/news.sh
lrwx------  1 root  wheel  16 Sep  6  1997 91ssh.sh@ -> ../init.d/ssh.sh

>  familiar with what should/shouldn't go into /sbin/init (which is where
>  this sort of thing would have to go, right?) but I'm certainly willing
>  to learn.

You could make it like HP-SUX (rc.conf instead of rc.config.d) without
writing one line of C :-) 

The only special things about HP-SUX's /etc/rc is that it displays fancy
graphics (probably the reason it is a binary and not a script).

My /etc/rc.shutdown script also does The Right Thing[tm] for me.

-=-=-=-
#!/bin/sh
#	$Id: rc.shutdown,v 1.1 1997/08/02 00:22:45 davidn Exp $

# site-specific closing actions for daemons run by init on shutdown
# or before going single-user from multi-user.
# Output and errors are directed to console by init, and the
# console is the controlling terminal.

stty status '^T'

# Set shell to ignore SIGINT (2), but not children;
# shell catches SIGQUIT (3) and returns to single user after fsck.
trap : 2
trap : 3	# shouldn't be needed

HOME=/; export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
export PATH

echo -n Shutting down daemon processes: 

# Insert shutdown procedures here

if [ -f /etc/rc.conf ]; then
	. /etc/rc.conf
fi

echo ''
# for each valid dir in $local_startup, search for init scripts matching
# *.sh
if [ "X${local_startup}" != X"NO" ]; then
	echo 'Local package shutdown:'
	# reverse the directory list
	for dir in ${local_startup}; do
		rdir_list="${dir} ${rdir_list}"
	done
	for dir in ${rdir_list}; do
		[ -d ${dir} ] && for script in `/bin/ls -r ${dir}/*.sh`; do
			[ -x ${script} ] && ${script} stop
		done
	done
fi

echo '.'
exit 0
-=-=-=-
-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr
FreeBSD keltia.freenix.fr 3.0-CURRENT #60: Fri May 15 21:04:22 CEST 1998

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



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