#!/bin/sh /etc/rc.common
# name:        /etc/init.d/nrserver.sh
# description: Starts and stops NeoRouter connection server
# os:          La Fonera
# contact:     support@neorouter.com

START=80

NRPORT=32976

start() 
{
    # set firewall
    if [  -z $(/usr/sbin/iptables -L | grep "$NRPORT" | head -n 1 | awk -F ' ' ' {print $1}') ]; then
       /usr/sbin/iptables -A input_daemon -p tcp --dport $NRPORT -j zone_wan_ACCEPT
    fi

    # launch neorouter
    /usr/bin/nrserver >/dev/null &
}

stop()
{
    # kill neorouter
    killall nrserver
}

