Subject: Creating an /etc/rc.d service script.
To: None <>
From: None <>
List: netbsd-users
Date: 08/17/2001 14:27:16
(I hope this isn't a rehash of some previous discussion on this list.
If so, please point me to the general time frame that it occurred and 
I'll look it up.)

On my NetBSD 1.5 system I've added a script to my /etc/rc.d directory to
start up
Netatalk-asun package installed via pkgsrc.  The package installed a file
to start-up the service in /usr/pkg/etc/rc.d/

The installed script only starts up the daemons, but I'd like my rc.d script
to additionally handle "stop" and "restart" arguments too.

I've been unsuccessful at desciphering exactly how I should use the
/etc/rc.subr and run_rc_command combination.  Will the "run_rc_command" do
what I want?  

It appears that netatalk does not keep a /var/run/ file.
Will my greps in the stop section (to search for the pid) foul up when 'ps'
the grep task in addition to the process I'm looking for?

Is the recursive call to /etc/rc.d/ under the restart OK?

TIA for any help.
- Roger

Heres what I have so far.

*-- snip --*

	# /etc/rc.d/
	# PROVIDE: atalk
	. /etc/rc.subr
	load_rc_config $name

#	if [ $1 = start ] ; then
#		run_rc_command "$1"
#	elif [ $1 = stop ] ; then
#		kill -HUP `ps -e | grep atalkd | awk '{print $1}'`
#		echo atalkd stopped
#		kill -HUP `ps -e | grep afpd | awk '{print $1}'`
#		echo afpd stopped
#		kill -HUP `ps -e | grep papd | awk '{print $1}'`
#		echo papd stopped
#	elif [ $1 = restart ] ; then
#		/etc/rc.d/ stop
#		/etc/rc.d/ start
#	else ;
#		echo command unavailable
#	fi
*-- snip --*