#!/bin/bash
### BEGIN INIT INFO
# Provides:          sipb-xen-database-server
# Required-Start:    $local_fs $remote_fs
# Required-Stop:     $local_fs $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: sipb-xen database server
# Description:       
### END INIT INFO

PACKAGE=sipb-xen-database-server

# Exit if the package is not installed
[ -x "/usr/bin/sipb-xen-database-tables" ] || exit 0

. /lib/init/vars.sh
. /lib/lsb/init-functions

gen_config()
{
  for i in /etc/postgresql/8.3/main/pg_hba.conf
  do mako-render $i.mako > $i
  done
}

case "$1" in
  start|reload|force-reload|restart)
    log_begin_msg "Reloading config for $PACKAGE"
    gen_config
    log_end_msg $?
    /etc/init.d/postgresql-8.3 "$1"
    ;;
  stop)
    ;;
  *)
    log_success_msg "Usage: /etc/init.d/$PACKAGE {start|reload|force-reload|restart|stop}"
    ;;
esac
