#!/bin/sh
### BEGIN INIT INFO
# Provides:          approx
# Required-Start:    $local_fs $remote_fs $network
# Required-Stop:     $local_fs $remote_fs $network
# Should-Start:      $syslog $time
# Should-Stop:       $syslog $time
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: approx caching proxy server
# Description:       Debian init script to start or stop the approx
#                    caching proxy server for Debian archive files
### END INIT INFO

# Author: Eric Cooper <ecc@cmu.edu>

PATH=/usr/sbin:/usr/bin:/sbin:/bin
DESC="proxy server for Debian archive files"
NAME=approx
DAEMON=/usr/sbin/$NAME
SCRIPTNAME=/etc/init.d/$NAME

# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0

# Read configuration variable file if it is present
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

# Define LSB log_* functions
. /lib/lsb/init-functions

case "$1" in
  start)
	log_daemon_msg "Starting $DESC" "$NAME"
	start-stop-daemon --start --quiet --exec $DAEMON
	log_end_msg $?
	;;
  stop)
	log_daemon_msg "Stopping $DESC" "$NAME"
	start-stop-daemon --stop --quiet --exec $DAEMON
	log_end_msg $?
	;;
  restart|force-reload)
	$0 stop
	sleep 1
	$0 start
	;;
  *)
	echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
	exit 1
	;;
esac

exit 0
