Sophie

Sophie

distrib > Mageia > cauldron > x86_64 > by-pkgid > 360891f31da1a3c2e3db3dd25cc88750 > files > 2

distcache-1.5.1-29.mga7.src.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() {
        echo -n $"Starting $prog: "
        daemon $dc_server $OPTIONS
        RETVAL=$?
	echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/dc_server
        return $RETVAL
}
stop() {
	echo -n $"Stopping $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
	;;
  *)
	echo $"Usage: $prog {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit $RETVAL