summaryrefslogtreecommitdiff
blob: f8f047c19f123314f5817f00dd09b64134298677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh

##########################################################################################
#RCUPDATE:3 4:71:Required for rc-update
. /etc/rc.d/config/functions

. /etc/rc.d/config/basic

SERVICE=postgres
EXE="/usr/bin/postmaster"
opts="start stop restart"

PGUSER="postgres"
USE_SYSLOG="yes"
FACILITY="local5"
PGLOGFILE="/tmp/portgres.log"
PGOPTS="-D/var/lib/pgsql"
PGPORT="5433"

start()	{
		if [ -f ${PGLOGFILE} ]
		then
		    my ${PGLOGFILE} ${PGLOGFILE}.old
		fi
		einfo "Starting ${SERVICE}.."
		if [ "${USE_SYSLOG}" = "yes" ]
		then
		  su - ${PGUSER} -c "${EXE} ${PGOPTS} -p ${PGPORT} 2>&1" | logger -p ${FACILITY}.notice 1>&2 & 	
		fi
		eend $? "Error starting ${SERVICE}."
}

stop ()	{
		einfo "Stopping ${SERVICE}..."
		killall -TERM ${EXE}
		eend $? "Error stopping ${SERVICE}."
}

restart() {
		stop
		start
}

doservice ${@}