aboutsummaryrefslogtreecommitdiff
path: root/databases/postgresql7/files/pgsql.sh.tmpl
blob: 3f8706d6af0ca7a46e2e507322e5700fd65a16c8 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh

# $FreeBSD$
#
# For postmaster startup options, edit $PGDATA/postgresql.conf
#
# Note that PGDATA is set in ~pgsql/.profile, don't try to manipulate it here!
#

PREFIX=%%PREFIX%%
PGBIN=${PREFIX}/bin

case $1 in
start)
    [ -x ${PGBIN}/pg_ctl ] && {
	echo -n ' pgsql'
	su -l pgsql -c \
	    "[ -d \${PGDATA} ] && exec ${PREFIX}/bin/pg_ctl start -s -w"
    }
    ;;

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

restart)
    [ -x ${PGBIN}/pg_ctl ] && {
	exec su -l pgsql -c "exec ${PREFIX}/bin/pg_ctl restart -s -m fast"
    }
    ;;

reload)
    [ -x ${PGBIN}/pg_ctl ] && {
	exec su -l pgsql -c "exec ${PREFIX}/bin/pg_ctl reload"
    }
    ;;

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

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