#!/bin/sh

# Files
OE_ADMIN_CONF="/etc/oe-admin.conf"
VPN_DOWN_FLAG="/tmpHost/vpn-down.stamp"

# Read TUNInterface from /etc/oe-admin.conf
TUNInterface=`admin-helper get-config ${OE_ADMIN_CONF} "TUNInterface"`

# Remove TUNInterface from /etc/oe-admin.conf
sed -i "/^TUNInterface /d" ${OE_ADMIN_CONF}

# Notify the manager that the VPN is down
/manager vpn_down ${TUNInterface}

# Daemon will monitor vpn down status by the existence of this file
touch ${VPN_DOWN_FLAG}

exit 0
