Created
December 3, 2014 10:56
-
-
Save breiter/b4111c581a3229fdaa69 to your computer and use it in GitHub Desktop.
vpnc-stop script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ "$(id -u)" -ne 0 ]; then | |
SELF=`echo $0 | sed -ne 's|^.*/||p'` | |
echo "$SELF must be run as root." 1>&2 | |
echo "try: sudo $SELF" 1>&2 | |
exit 1 | |
fi | |
PLIST=/Library/LaunchDaemons/com.wolfereiter.vpnc.plist | |
CONF=`grep \.conf $PLIST | sed 's/<[^>]*>//g' | tr -d " \t"` | |
GATEWAY=`grep gateway $CONF` | |
ERROR=$( { /bin/launchctl unload -w $PLIST; } 2>&1 ) | |
if [ -z "$ERROR" ]; then | |
echo "stopping vpnc daemon connection to $GATEWAY." | |
else | |
echo $ERROR | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment