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>
40f31a6
# Modifyed 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
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
f783ca4
LOCKFILE=/var/lock/subsys/3proxy
f783ca4
#LOGFILE=/var/log/3proxy.log
f783ca4
f783ca4
start() {
f783ca4
	echo -n $"Starting $prog: "
40f31a6
	# daemon --pidfile "${PIDFILE}" sh -c "exec \"$PROXY\" \"$CONFIG\" 2>&1 > \"$LOGFILE\" &"
40f31a6
	daemon "$PROXY" "$CONFIG"
f783ca4
	RETVAL=$?
f783ca4
	echo
40f31a6
		[ 0 -eq $RETVAL ] && touch ${LOCKFILE}
f783ca4
	return $RETVAL
f783ca4
}
f783ca4
f783ca4
stop() {
f783ca4
	echo -n $"Stopping $prog: "
40f31a6
	killproc -d 3 "$prog"
f783ca4
	RETVAL=$?
f783ca4
	echo
40f31a6
		[ 0 -eq $RETVAL ] && rm -f ${LOCKFILE}
f783ca4
	return $RETVAL
f783ca4
}
f783ca4
f783ca4
restart() {
f783ca4
	stop
f783ca4
	start
f783ca4
}
f783ca4
f783ca4
reload(){
f783ca4
	echo -n $"Reloading $prog: "
40f31a6
	killproc $prog -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)
40f31a6
	status "$PROXY"
f783ca4
	RETVAL=$?
f783ca4
	;;
f783ca4
  *)
40f31a6
	echo $"Usage: $0 {start|stop|restart|condrestart|status|reload}"
f783ca4
	RETVAL=1
f783ca4
	;;
f783ca4
esac
f783ca4
f783ca4
exit $RETVAL