#!/bin/sh
#ondemand progress need run when net_status change
ondemand_enbale=`uci get sysmode.ondemand.enabled`

if [ "$ondemand_enbale" != "1" ];then
	return 0;
fi

echo "run_net_notifylist_work_with_"$1

isexist_progress_withcgi(){
	local is_progree_exsit="$(ps | grep $1 | wc -l)"
	if [ $is_progree_exsit -lt "2" ];then 
		$1 $2 &
	fi
	return 0
}

//reload 需要根据WAN/LAN 状态变化的ondemand服务进程
case "$1" in
	lan)
	isexist_progress_withcgi /app/anti_ddos/bin/anti_ddos -l
	isexist_progress_withcgi /app/portmap/bin/igd_nat_app -l;;
	wan) 
	isexist_progress_withcgi /app/anti_ddos/bin/anti_ddos -w
	isexist_progress_withcgi /app/dns_tramper/bin/dns_tramper_app -w
	isexist_progress_withcgi /app/portmap/bin/igd_nat_app -w
#	isexist_progress_withcgi /app/oray_ddns/bin/orayapp -w;; half ondemand ,no need send msg
	*) echo error_args_net_notifylist_work;;
esac


