#!/bin/sh

# set global env setting
. /opt/jilroy/checkit//bin/env

if [ "$1" = "" ]
then
	echo	"Usage:discovernetwitharp  Action [ Provisioning_files_dir ]
		Where: Action = [ Add | DeleteNotInProvisioning |DeleteProvisioningList |  
	 			  AddProvisioningFromArp | Periodic | ForceRediscover | All ]  
		Add - adds nodes which are in the provisioning file and not in the database
		DeleteNotInProvisioning - deletes nodes which are in the database and not in the provisioning file
		DeleteProvisioningList - deletes nodes which are in the provisioning list
		AddProvisioningFromArp - add entries from arp table to existing provisioning file
		Periodic - rediscover all nodes which their last discovery time expired
		ForceRediscover - rediscovers all nodes which are flaged for rediscovery in the provisioning file
		All - does all the actions listed above not including:DeleteProvisioningList & AddProvisioningFromArp "


else
	PROVISIONING_FILE=$2
	if [ "$2" = "" ]
	then
		PROVISIONING_FILE=/opt/jilroy/checkit//conf/provisioning.csv
	fi

	/opt/jilroy/checkit//bin/buildprovisionfromarp $PROVISIONING_FILE
	$RUN_JAVA com.rj.networkdiscovery.NetworkDiscoveryMain $APP_CONFIG_FILE $1 $PROVISIONING_FILE
fi


