#!/bin/sh

# Bring up/down debug tools

SETSID=/usr/bin/setsid
KILLALL=/usr/bin/killall


do_start ()
{
	SSHD=$(command -v sshd)
	if [ $? -ne 0 ]; then
	    echo "sshd not installed."
	    exit 1
	fi
	echo -n "  sshd: "
	mkdir -p /var/empty/sshd
	$SETSID $SSHD > /dev/null 2>&1 && echo "started" || echo "failed"
#	/etc/init.d/sshd start > /dev/null 2>&1  && echo "done" || echo "failed"
}

do_stop ()
{
	rm -fr /var/empty/sshd
	$KILLALL -9 sshd
}

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

exit $?
