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
# pidfile: /var/run/3proxy.pid
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
PIDFILE=/var/run/3proxy.pid
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\" &"
11bb44e
	daemon --pidfile "${PIDFILE}" "$PROXY" "$CONFIG"
11bb44e
	RETVAL=$?
11bb44e
	echo
11bb44e
		[ $RETVAL = 0 ] && touch ${LOCKFILE}
11bb44e
	return $RETVAL
11bb44e
}
11bb44e
11bb44e
stop() {
11bb44e
	echo -n $"Stopping $prog: "
11bb44e
	killproc -p "${PIDFILE}" -d 1 "$PROXY"
11bb44e
	RETVAL=$?
11bb44e
	echo
11bb44e
		[ $RETVAL = 0 ] && rm -f ${LOCKFILE} ${PIDFILE}
11bb44e
	return $RETVAL
11bb44e
}
11bb44e
11bb44e
restart() {
11bb44e
	stop
11bb44e
	start
11bb44e
}
11bb44e
11bb44e
reload(){
11bb44e
	echo -n $"Reloading $prog: "
11bb44e
	killproc -p ${pidfile} $httpd -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)
11bb44e
	status -p "$PIDFILE" "$PROXY"
11bb44e
	RETVAL=$?
11bb44e
	;;
11bb44e
  *)
11bb44e
	echo $"Usage: $0 {start|stop|restart|condrestart|status}"
11bb44e
	RETVAL=1
11bb44e
	;;
11bb44e
esac
11bb44e
11bb44e
exit $RETVAL