#!/bin/bash
#
# phonedb	This shell script takes care of starting and stopping pblogan.
#
# chkconfig: 2345 65 35
# description: pblogan - Phone Box Log Analyzer allows you to \
# capture and view the logs from a PBX. By connecting to the \
# serial port of the PBX (usually used for printing to a serial \
# printer) the logs may be captured and fed to a PostgreSQL \
# database. A PHP Web interface to this database is provided. 
#
# probe: false
# processname: phonedb
# pidfile: /var/run/phonedb.pid
# config: /etc/pblogan.conf

# 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/phonedb ] || exit 0

# See how we were called.
case "$1" in
start)
	gprintf "Starting phonedb: "
	daemon phonedb -d
	echo
	touch /var/lock/subsys/phonedb
	;;
stop)
	gprintf "Stopping phonedb: "
	killproc phonedb
	echo
	rm -f /var/lock/subsys/phonedb
	;;
status)
	status phonedb
	;;
restart|reload)
	$0 stop
	$0 start
	;;
condrestart)
	[ -f /var/lock/subsys/phonedb ] && restart
	;;
  *)
	gprintf "Usage: phonedb {start|stop|status|restart|condrestart|reload}\n"
	exit 1
esac

exit 0
