#!/bin/bash

# Bring up/down debug tools

SETSID=/usr/bin/setsid

if [ -e "/tmp/featurestatus.conf" ] ; then
    . /tmp/featurestatus.conf
fi

if [ "$SEC_START_ACTIVATION" != "true" ]; then
    #The device is not activated. exiting ...
    exit 0
fi

KILLALL=/usr/bin/killall

do_start ()
{
	echo -n "  sshd: "
	mkdir -p /var/empty/sshd
	$SETSID /etc/init.d/sshd start > /dev/null 2>&1  && echo "done" || echo "failed"
}

do_stop ()
{
	rm -fr /var/empty/sshd
	/etc/init.d/sshd stop
	$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 $?
