#!/bin/sh
export PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin"

ulimit -n 1024000
ulimit -u 1024000
echo 1024000 > /proc/sys/fs/file-max
echo 1024000  > /proc/sys/net/nf_conntrack_max 

while true
do
	curtime=`date`
	num=`ps -ef |grep my-socks5 |grep -v grep|wc -l`
	if [ $num -gt 0 ];then
		echo "">/dev/null
	else
		echo $curtime":my-socks5 It's down"
		/usr/sbin/daemonize -a -e /var/log/my-socks5-error.log -o /var/log/my-socks5-output.log /usr/local/bin/my-socks5
		#/usr/sbin/daemonize /usr/local/bin/my-socks5
	fi	
	sleep 2
done