#!/bin/sh /etc/rc.common
# Copyright (c), NETGEAR, Inc.
# 350 East Plumeria, San Jose California, 95134, U.S.A.
# All rights reserved.
#
# This software is the confidential and proprietary information of
# NETGEAR, Inc. ("Confidential Information").  You shall not
# disclose such Confidential Information and shall use it only in
# accordance with the terms of the license agreement you entered into
# with NETGEAR.

START=96

USE_PROCD=1

PROG="/opt/netgear/usr/bin/insight-configd"
ARGS="-l 2 -r -q"
LIB_DIR="/opt/netgear/usr/lib"

start_service() {
        procd_open_instance

        procd_set_param command $PROG $ARGS
        # respawn automatically if something died, be careful if you have an alternative process supervisor
        # if process dies sooner than respawn_threshold, it is considered crashed and after 5 retries the service is stopped
        procd_set_param respawn ${respawn_threshold:-60} ${respawn_timeout:-30} ${respawn_retry:-0}

        procd_set_param env LD_LIBRARY_PATH=$LIB_DIR
        procd_set_param limits core="16MB"
        procd_set_param stdout 1 # forward stdout of the command to logd
        procd_set_param stderr 1 # forward stderr of the command to logd
        procd_set_param user root
        procd_set_param pidfile /var/run/insight-configd.pid

        procd_close_instance
}
