#!/bin/sh
#
# chkconfig: 345 86 24
# description: This script takes care of starting and stopping socks5.
#

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

[ -f /usr/sbin/socks5 ] || exit 0

# See how we were called.
case "$1" in
  start)
        # Start daemons.
        gprintf "Starting socks5: "
        daemon socks5
        touch /var/lock/subsys/socks5
        echo
        ;;
  stop)
        # Stop daemons.
        gprintf "Shutting down socks5: "
	stopsocks
        gprintf "done\n"
        rm -f /var/lock/subsys/socks5
        ;;
  restart|reload)
	$0 stop
	$0 start
	;;
  status)
	status socks5
	;;
  *)
        gprintf "Usage: socks5 {start|stop|status|restart|reload}\n"
        exit 1
esac

exit 0
