Skip to content

Instantly share code, notes, and snippets.

@lj0014
Created June 29, 2015 09:29
Show Gist options
  • Save lj0014/9ab224b0789cfe591938 to your computer and use it in GitHub Desktop.
Save lj0014/9ab224b0789cfe591938 to your computer and use it in GitHub Desktop.
ocserv script
#!/bin/bash
function stop
{
progress_key=$1
ps -ef | grep $progress_key | grep -v grep | awk '{print $2}' | xargs -i kill -9 {}
}
function start
{
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -j MASQUERADE
#iptables -A FORWARD -p tcp --tcp-flags SYN,RST SYN -j TCPMSS --clamp-mss-to-pmtu
$bin -c /etc/ocserv/ocserv.conf
}
bin="/usr/local/sbin/ocserv"
cmd=$1
if [ "$cmd" == "start" ];then
start
elif [ "$cmd" == "stop" ];then
stop "$bin"
elif [ "$cmd" == "restart" ];then
stop "$bin"
sleep 1
start
else
echo "invalied command!"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment