#!/bin/sh
# Init file for Intranet Chat server daemon
#
# chkconfig: 2345 55 25
# description: Intranet Chat server daemon
#
# processname: ichatsrvd.bin
# pidfile: /var/run/ichatsrvd/ichatsrvd.pid

# source function library

. /etc/rc.d/init.d/functions

SourceIfNotEmpty /etc/sysconfig/svnserve

PIDFILE=/var/run/ichatsrvd/ichatsrvd.pid
LOCKFILE=/var/lock/subsys/ichatsrvd
CHECKTIME=60

# See how we were called.
case "$1" in
  start)
	# Start daemon.
        start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --user ichat --expect-user ichat  -- /usr/sbin/ichatsrvd.bin || failure
	;;
  stop)
	# Stop daemon.
	echo -n "Shutting down ichatsrvd: "
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user ichat -- /usr/sbin/ichatsrvd.bin || failure
	;;
  restart)
	$0 stop
	$0 start
	;;
  condrestart)
        if [ -e "$LOCKFILE" ]; then
	$0 restart
	fi
	;;
  status)
        status --pidfile "$PIDFILE" --expect-user ichat --name ichatsrvd.bin -- /usr/sbin/ichatsrvd.bin
	;;
  *)
	echo "Usage: ichatsrvd {start|stop|restart|condrestart|status}"
	exit 1
esac

exit 0
