#!/bin/sh # # $Id: etc__init_d__postgres,v 1.5 2005/03/12 21:46:10 webcms Exp $ # # postgres This shell script takes care of starting and stopping # postgres. Read more about starting and stopping on # www.infocopter.com/know-how/postgresql/start-stop.html # # chkconfig: 2345 65 35 # description: postgres provides support for foo services. PATH=/usr/sbin:/root/bin:${PATH} PGDATA=/home/postgres/data export PATH PGDATA POSTGRES='/usr/local/pgsql/bin/pg_ctl' # Source function library. INITD=/etc/rc.d/init.d . $INITD/functions case "$1" in start) echo -n "Starting postgresql service: " su - postgres -c "$POSTGRES -D $PGDATA -l /var/log/postgres -o \"-i -p 5432\" start" >/dev/null 2>&1 /dev/null 2>&1 ret=$? if [ $ret -eq 0 ] then echo_success else echo_failure fi echo ;; restart) $0 stop sleep 1 $0 start ;; status) status postmaster ;; *) echo "Usage: postgres {start|stop|restart|status}" exit 1 esac exit 0