#!/bin/bash

. /usr/local/recordum/sys/defaults.include

SCRIPT_DESC="Setup DB"


stop_daemons
stop_db

pg_dropcluster --stop 8.4 main

pg_createcluster 8.4 main || exit_onerror 1 "Could not create database cluster, with error $?"

# Restore default config files
cp $BACKUPDIR_LOCAL/postgresql.conf /etc/postgresql/8.4/main/ || exit_onerror 2 "Could not copy default config files for database cluster main"
cp $BACKUPDIR_LOCAL/pg_hba.conf /etc/postgresql/8.4/main/ || exit_onerror 3 "Could not copy default config files for database cluster main"

exit 0


