Subject: The new rc.d stuff...
To: None <current-users@netbsd.org>
From: Mason Loring Bliss <mason@acheron.middleboro.ma.us>
List: current-users
Date: 03/18/2000 11:10:06
--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii


The new rc.d stuff pretty much rocks. I like it.

Enclosed are my sshd and atalkd scripts, in case anyone wants random examples
to peruse, along with my rc.local.conf file. The atalkd script is incomplete
and would be better off as a series of individual scripts for each requisite
daemon, but it makes for a good example of how to do "quick and dirty" con-
versions. The sshd thing should work with either OpenSSH or Datafellows
without modification, IIRC.

(Of course, if I've done something unutterably evil, feel free to flame me.
I only did this stuff this morning. It works for me.)

-- 
   Mason Loring Bliss   mason@acheron.middleboro.ma.us              E w i g e
awake ? sleep : dream;  http://acheron.ne.mediaone.net  B l u m e n k r a f t


--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=atalkd

#!/bin/sh

# PROVIDE: atalkd
# REQUIRE: xdm

. /etc/rc.subr
. /etc/rc.conf

name="atalkd"
start_cmd="do_atalkd"
stop_cmd="kill_atalkd"

do_atalkd()
{
  echo -n 'starting appletalk daemons:'
  if [ -f /usr/pkg/sbin/atalkd ]; then
	  /usr/pkg/sbin/atalkd;		echo -n ' atalkd'
  fi

  if [ -f /usr/pkg/bin/nbprgstr ]; then
	  /usr/pkg/bin/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:Workstation
	  /usr/pkg/bin/nbprgstr -p 4 `hostname|sed 's/\..*$//'`:netatalk
					  echo -n ' nbprgstr'
  fi

  if [ -f /usr/pkg/sbin/papd ]; then
	  /usr/pkg/sbin/papd;		echo -n ' papd'
  fi

  if [ -f /usr/pkg/sbin/afpd ]; then
	  /usr/pkg/sbin/afpd;		echo -n ' afpd'
  fi

  if [ -f /usr/pkg/sbin/timelord ]; then
	  /usr/pkg/sbin/timelord;		echo -n ' timelord'
  fi

					echo '.'
}

kill_atalkd()
{
  echo "Killing afpd processes..."
  ps ax | grep afpd | grep -v grep | awk '{print $1}' | xargs -n 1 kill
  echo "Killing atalkd processes..."
  ps ax | grep atalkd | grep -v grep | awk '{print $1}' | xargs -n 1 kill
}

run_rc_command "$1"


--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=sshd

#!/bin/sh
#

# PROVIDE: sshd
# REQUIRE: named

. /etc/rc.subr
. /etc/rc.conf

name="sshd"
command="/usr/pkg/sbin/${name}"
pidfile="/var/run/${name}.pid"
required_files="/etc/sshd_config"

start_precmd="sshd_precmd"

sshd_precmd()
{
	if [ ! -f /etc/ssh_host_key ]; then
		/usr/pkg/bin/ssh-keygen -f /etc/ssh_host_key -N ''
	fi
}

run_rc_command "$1"

--dDRMvlgZJXvWKvBx
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rc.local.conf"

atalkd=YES		atalkd_flags=""
sshd=YES		sshd_flags=""
wnsd=YES		wnsd_flags="-A 0"
zrandom=YES		zrandom_flags=""

--dDRMvlgZJXvWKvBx--