Sophie

Sophie

distrib > Mandriva > mes5 > i586 > by-pkgid > c9e21e4e8625a91bfc2164086c9633a3 > files > 2

imapproxy-1.2.6-5mdv2009.0.src.rpm

#!/bin/sh
#
# chkconfig: - 85 15
# description: Imapproxy is a proxy for the IMAP protocol
# processname: in.imapproxyd
# config: /etc/imapproxy.conf

# Script Author: Simon Matter <simon.matter@invoca.ch>
# Version: 2003062600

# Source function library.
if [ -f /etc/init.d/functions ]; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

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

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

# This is our service name
BASENAME=`basename $0`
if [ -L $0 ]; then
  BASENAME=`find $0 -name $BASENAME -printf %l`
  BASENAME=`basename $BASENAME`
fi

[ -f /etc/${BASENAME}.conf ] || exit 1

PROCNAME=in.imapproxyd
RETVAL=0

start() {
  echo -n "Starting $BASENAME: "
  daemon /usr/sbin/$PROCNAME
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$BASENAME
  return $RETVAL
}

stop() {
  echo -n "Shutting down $BASENAME: "
  killproc $PROCNAME
  RETVAL=$?
  echo
  [ $RETVAL -eq 0 ] && rm -f /var/run/pimpstats
  [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$BASENAME
  return $RETVAL
}

restart() {
  stop
  start
}

rhstatus() {
  status $PROCNAME
}

condrestart() {
  [ -e /var/lock/subsys/$BASENAME ] && restart || :
}

# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  restart)
    restart
    ;;
  reload)
    restart
    ;;
  condrestart)
    condrestart
    ;;
  status)
    rhstatus
    ;;
  *)
    echo $"Usage: $BASENAME {start|stop|restart|reload|condrestart|status}"
    RETVAL=1
esac
 
exit $RETVAL