11bb44e
#!/bin/sh
11bb44e
#
11bb44e
# Init file for Software Watchdog daemon.
11bb44e
#
11bb44e
# Written by Dag Wieers <dag@wieers.com>.
11bb44e
# Rewrote for ALT Linux by Pavlov Konstantin <thresh@altlinux.ru>
11bb44e
# Modifyed for Fedora by Pavel Alexeev aka Pahan-Hubbitus <Pahan@hubbitus.info>
11bb44e
#
11bb44e
# chkconfig: - 02 98
11bb44e
# description: 3proxy Proxy Server
11bb44e
#
11bb44e
# processname: 3proxy
11bb44e
# config: /etc/3proxy.cfg
11bb44e
11bb44e
WITHOUT_RC_COMPAT=1
11bb44e
11bb44e
. /etc/init.d/functions
11bb44e
11bb44e
### Default variables
11bb44e
prog=3proxy
11bb44e
CONFIG=/etc/3proxy.cfg
11bb44e
PROXY=/usr/bin/3proxy
11bb44e
RETVAL=0
11bb44e
LOCKFILE=/var/lock/subsys/3proxy
11bb44e
#LOGFILE=/var/log/3proxy.log
11bb44e
11bb44e
start() {
11bb44e
	echo -n $"Starting $prog: "
11bb44e
	# daemon --pidfile "${PIDFILE}" sh -c "exec \"$PROXY\" \"$CONFIG\" 2>&1 > \"$LOGFILE\" &"
71d26c2
	daemon "$PROXY" "$CONFIG"
11bb44e
	RETVAL=$?
11bb44e
	echo
71d26c2
		[ 0 -eq $RETVAL ] && touch ${LOCKFILE}
11bb44e
	return $RETVAL
11bb44e
}
11bb44e
11bb44e
stop() {
11bb44e
	echo -n $"Stopping $prog: "
71d26c2
	killproc -d 3 "$prog"
11bb44e
	RETVAL=$?
11bb44e
	echo
71d26c2
		[ 0 -eq $RETVAL ] && rm -f ${LOCKFILE}
11bb44e
	return $RETVAL
11bb44e
}
11bb44e
11bb44e
restart() {
11bb44e
	stop
11bb44e
	start
11bb44e
}
11bb44e
11bb44e
reload(){
11bb44e
	echo -n $"Reloading $prog: "
71d26c2
	killproc $prog -USR1
11bb44e
	RETVAL=$?
11bb44e
	echo
11bb44e
}
11bb44e
11bb44e
case "$1" in
11bb44e
  start)
11bb44e
	start
11bb44e
	;;
11bb44e
  stop)
11bb44e
	stop
11bb44e
	;;
11bb44e
  restart)
11bb44e
  	restart
11bb44e
	;;
11bb44e
  reload)
11bb44e
	reload
11bb44e
	;;
11bb44e
  condrestart)
11bb44e
	[ -e $LOCKFILE ] && restart
11bb44e
	RETVAL=$?
11bb44e
	;;
11bb44e
  status)
71d26c2
	status "$PROXY"
11bb44e
	RETVAL=$?
11bb44e
	;;
11bb44e
  *)
71d26c2
	echo $"Usage: $0 {start|stop|restart|condrestart|status|reload}"
11bb44e
	RETVAL=1
11bb44e
	;;
11bb44e
esac
11bb44e
11bb44e
exit $RETVAL