summaryrefslogtreecommitdiffstats
path: root/databases/postgresql74-server/files/pgsql.sh.tmpl
blob: 46aff1eb4718374c7ceab2b877c8f0042a470ca8 (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
#!/bin/sh

# $FreeBSD$
#
# For postmaster startup options, edit $PGDATA/postgresql.conf

PGBIN=%%PREFIX%%/%%PG_PREFIX%%bin

case $1 in
start)
    [ -d %%PREFIX%%/%%PG_PREFIX%%lib ] && /sbin/ldconfig -m %%PREFIX%%/%%PG_PREFIX%%lib
    [ -x ${PGBIN}/pg_ctl ] && {
	su -l pgsql -c \
	    '[ -d ${PGDATA} ] && exec %%PREFIX%%/%%PG_PREFIX%%bin/pg_ctl start -s -w -l ~pgsql/errlog'
	echo -n ' pgsql'
    }
    ;;

stop)
    [ -x ${PGBIN}/pg_ctl ] && {
	exec su -l pgsql -c 'exec %%PREFIX%%/%%PG_PREFIX%%bin/pg_ctl stop -m fast'
    }
    ;;

status)
    [ -x ${PGBIN}/pg_ctl ] && {
	exec su -l pgsql -c 'exec %%PREFIX%%/%%PG_PREFIX%%bin/pg_ctl status'
    }
    ;;

*)
    echo "usage: `basename $0` {start|stop|status}" >&2
    exit 64
    ;;
esac
OpenPOWER on IntegriCloud