Skip to content

Instantly share code, notes, and snippets.

@panda1100
Created October 2, 2018 01:49
Show Gist options
  • Save panda1100/c74b752277b829d3f896fa440dacef02 to your computer and use it in GitHub Desktop.
Save panda1100/c74b752277b829d3f896fa440dacef02 to your computer and use it in GitHub Desktop.
#!/bin/bash
SCRIPTDIR=$( cd "$(dirname "$0")" ; pwd -P )
SCRIPTFILE=`basename "$0"`
profile_id=f038cf34b6d040eda5339059f5a4a92f
function start(){
sudo pritunl-client start $profile_id
}
function stop(){
sudo pritunl-client stop $profile_id
}
function enable(){
sudo pritunl-client enable $profile_id
}
function disable(){
sudo pritunl-client disable $profile_id
}
function daemon(){
sudo pritunl-client daemon
}
function list(){
sudo pritunl-client list
}
function configure(){
sed -i "s/^profile_id=.*/profile_id=$1/" $SCRIPTDIR/$SCRIPTFILE
echo "default is set to $1"
}
function default(){
sudo pritunl-client list
echo -n "set default profile_id: "
read id
configure $id
}
function show(){
echo "default profile_id is $profile_id"
}
while getopts ":c:-:" opt; do
case "$opt" in
-)
case "${OPTARG}" in
start)
start
;;
stop)
stop
;;
enable)
enable
;;
disable)
disable
;;
list)
list
;;
daemon)
daemon
;;
default)
default
;;
show)
show
;;
esac
;;
c)
configure "${OPTARG}"
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment