Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > main-release > by-pkgid > acd91127ffcf69f2ea507f5958b88f89 > files > 1

distcache-server-1.5.1-17mdv2010.1.x86_64.rpm

#!/bin/bash
#
# dc_server	This shell script takes care of starting and stopping
#		the Distcache SSL Session Cache Server.
#
# chkconfig: 345 90 10
# description: dc_server - Distributed session cache server. \
# dc_server runs a cache server and starts listening on a \
# configurable network address for connections. Incoming \
# connections are expected to communicate using the distcache \
# protocol, and would typically be instances of dc_client \
# running on other machines.
# probe: false
# processname: dc_server
# pidfile: /var/run/dc_server.pid

### BEGIN INIT INFO
# Provides: dc_server
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 3 4 5
# Short-Description: Distributed Session Cache Server.
# Description: Distributed Session Cache Server.
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -f /usr/sbin/dc_server ] || exit 0

if [ -f /etc/sysconfig/distcache ]; then
        . /etc/sysconfig/distcache
fi

port=${PORT-5555}
sessions=${SESSIONS-3000}

prog=dc_server
RETVAL=0
runas=nobody
dc_server=/usr/sbin/dc_server

OPTIONS="-daemon -pidfile /var/run/dc_server.pid -user ${runas} -sessions ${sessions} -listen IP:${port}"

start() {
        gprintf "Starting %s: " "$prog"
        daemon $dc_server $OPTIONS
        RETVAL=$?
	echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/dc_server
        return $RETVAL
}
stop() {
	gprintf "Stopping %s: " "$prog"
	killproc $dc_server
	RETVAL=$?
	echo
	[ $RETVAL = 0 ] && rm -f /var/lock/subsys/dc_server /var/run/dc_server.pid
}

# See how we were called.
case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  status)
        status $dc_server
	RETVAL=$?
	;;
  restart|reload)
	stop
	start
	;;
  condrestart)
	if [ -f /var/run/dc_server.pid ] ; then
		stop
		start
	fi
	;;
  *)
	gprintf "Usage: %s {start|stop|status|restart|condrestart|reload}\n" "$prog"
	exit 1
esac

exit $RETVAL