#!/bin/sh

# Files and Directories
MANAGER_VPN_UP_D="/etc/manager.d/vpn-up.d"
MANAGER_LOG_NAME="mc.manager"

manager_vpn_up () {
	# Run target-specific vpn-up script parts
	if [ "`ls -A ${MANAGER_VPN_UP_D}/*`" != "" ]; then
		for each in ${MANAGER_VPN_UP_D}/*; do
			sh ${each}
		done
	fi

	logger "${MANAGER_LOG_NAME}[$$]" -p "daemon.info" "VPN is now up.  Restarting kwilt-index and access-patrol"

	# TODO: notify kwilt-index that the vpn is up instead of restarting
	/etc/init.d/S95kwilt-index restart
	# TODO: notify access-patrol that the vpn is up instead of restarting
	/etc/init.d/S97access-patrol restart

	return 0
}
