aboutsummaryrefslogtreecommitdiff
path: root/databases/postgresql-devel/files/pgsql.sh.tmpl
blob: 753e0b8aaf804f08435f7fc256d9275865fbcb30 (plain) (blame)
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
#!/bin/sh

# $FreeBSD$
#
# For postmaster startup options, edit $PGDATA/postmaster.opts.default
# Preinstalled options are -i -o "-F"

case $1 in
start)
    [ -d !!PREFIX!!/pgsql/lib ] && /sbin/ldconfig -m !!PREFIX!!/pgsql/lib
    [ -x !!PREFIX!!/pgsql/bin/pg_ctl ] && {
	su -l pgsql -c \
	    'exec !!PREFIX!!/pgsql/bin/pg_ctl -w start > !!PREFIX!!/pgsql/errlog 2>&1'
	echo -n ' pgsql'
    }
    ;;

stop)
    [ -x !!PREFIX!!/pgsql/bin/pg_ctl ] && {
	exec su -l pgsql -c 'exec !!PREFIX!!/pgsql/bin/pg_ctl -w -m fast stop'
    }
    ;;

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

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