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