aboutsummaryrefslogtreecommitdiffstats
path: root/databases/postgresql73/files/pgsql.sh.tmpl
blob: d67d9b642f1b203714d05fc85d0e604e9e6b3df0 (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
#!/bin/sh

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

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

case $1 in
start)
    [ -d ${PREFIX}/lib ] && /sbin/ldconfig -m ${PREFIX}/lib
    touch /var/log/pgsql
    chmod 600 /var/log/pgsql
    chown pgsql:pgsql /var/log/pgsql
    [ -x ${PGBIN}/pg_ctl ] && {
    su -l pgsql -c \
        '[ -d ${PGDATA} ] && exec %%PREFIX%%/bin/pg_ctl start -s -w -l /var/log/pgsql'
    echo -n ' pgsql'
    }
    ;;

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

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

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