Skip to content

Instantly share code, notes, and snippets.

@breiter
Created December 3, 2014 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save breiter/88c9c9e3e06a6c7012d6 to your computer and use it in GitHub Desktop.
Save breiter/88c9c9e3e06a6c7012d6 to your computer and use it in GitHub Desktop.
vpnc-start script
#!/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 load -w $PLIST; } 2>&1 )
if [ -z "$ERROR" ]; then
echo "starting 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