#!/bin/sh
#
# code by ngc1927

cd /tmp
STOPPED=0
REMOVED=0

kill -9 `pidof openvpn` 1>/dev/null 2>/dev/null && STOPPED=1

[ -e /var/etc/rcS.d/S80openvpn.sh ] && rm -f /var/etc/rcS.d/S80openvpn.sh

#remove module from memory
rmmod tun 1>/dev/null 2>/dev/null && REMOVED=1

[ -e /dev/net/tun ] && rm -f /dev/net/tun 1>/dev/null 2>/dev/null
[ -e /dev/net ] && rm -rf /dev/net 1>/dev/null 2>/dev/null

if [ "$STOPPED" == "1" ]; then
	echo "Openvpn stopped"
else
	echo "Openvpn not active?"
fi

if [ "$REMOVED" == "1" ]; then
	echo "Module removed"
else
	echo "Module not loaded?"
fi

exit 0
