#!/bin/sh /etc/rc.common

START=99
STOP=10

USE_PROCD=1
PROG="/opt/oisp/bin/tunneld"

start_service() {
    # Check if tunnel is needed
    if ! "$PROG" --is-tunnel-required; then
        return 0
    fi

    procd_open_instance
    procd_set_param command "$PROG"
    procd_set_param respawn
    procd_set_param stdout 1  # Redirect stdout to log
    procd_set_param stderr 1  # Redirect stderr to log
    procd_close_instance
}
