#!/bin/sh /etc/rc.common
USE_PROCD=1
START=30

start_mwan3()
{
    proto=$1
    logger -t modem_mwan "before set $proto start"
    /usr/share/qmodem/modem_mwan.sh $proto start
    logger -t modem_mwan "set $proto start"

}

start_service() {
    logger -t modem_mwan "start qmodem_mwan"
	config_load qmodem_mwan
    config_get enable global enable_mwan 0
    if [ "$enable" -eq 0 ]; then
        stop_service
        return
    fi
    start_mwan3 ipv4
}

stop_service() {
    /usr/share/qmodem/modem_mwan.sh ipv4 stop
    /etc/init.d/mwan3 stop
}

service_triggers() {
	procd_add_reload_trigger 'qmodem_mwan'
}

reload_service() {
    stop
    start
}
