#!/bin/sh
APP_NAME=rfbd
if dirname "$0" 1>/dev/null 2>/dev/null; then
    SH_DIR="$(cd "$(dirname "$0")";pwd)"
    cd $SH_DIR
fi
. ./$APP_NAME-inc.sh
init_env
set_sys_env
$sudoprefix chmod +x ./${APP_NAME}

set_firewall()
{
    line=$(./$APP_NAME -q -p | grep rfp_server_port)
    set_firewall_port "${line#*=}"

    line=$(./$APP_NAME -q -p | grep http_server_port)
    set_firewall_port "${line#*=}"
}

$sudoprefix sh ./$APP_NAME-stop.sh
set_firewall
$sudoprefix sh ./$APP_NAME-daemon.sh &
