Created
June 29, 2015 09:29
-
-
Save lj0014/9ab224b0789cfe591938 to your computer and use it in GitHub Desktop.
ocserv script
This file contains hidden or 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/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