#!/bin/sh

. /etc/init.d/init-functions

case "$1" in
        start)
                notify "Starting telnet "
                telnetd -S -p $(cat /etc/openrouter/telnet/port)
                echo $! > /var/run/telnet.pid
		check $?
                ;;
        stop)
                notify "Stopping telnet "
                killall telnetd
                rm /var/run/telnet.pid
                check $?
                ;;
        restart|reload)
                "$0" stop
                "$0" start
                ;;
        *)
                echo "telnet init script usage: $0 {start|stop|restart}"
                return 1
esac
return $?
