#!/bin/sh
#
# sshd        Starts sshd.
#

# Make sure the ssh-keygen progam exists
[ -f /usr/bin/ssh-keygen ] || exit 0

# Create any missing keys
/usr/bin/ssh-keygen -A

umask 077

start() {
	echo -n "Starting sshd: "
	/usr/sbin/sshd
	touch /var/lock/sshd
	echo "OK"
}
stop() {
	echo -n "Stopping sshd: "
	killall sshd
	rm -f /var/lock/sshd
	echo "OK"
}
restart() {
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	restart
	;;
  *)
	echo "Usage: $0 {start|stop|restart}"
	exit 1
esac

exit $?

