1 | #!/bin/sh |
---|
2 | # |
---|
3 | # DarwinPorts generated StartupItem |
---|
4 | # |
---|
5 | |
---|
6 | . /etc/rc.common |
---|
7 | |
---|
8 | PGDATA=${PGDATA:='/opt/local/var/db/pgsql/defaultdb'} |
---|
9 | if [ ! -d ${PGDATA} ]; then |
---|
10 | ConsoleMessage "Error starting PostgreSQL-8: PGDATA directory '$PGDATA' doesn't exist!" |
---|
11 | exit 1 |
---|
12 | fi |
---|
13 | |
---|
14 | StartService () |
---|
15 | { |
---|
16 | if [ "${POSTGRESQL8:=-NO-}" = "-YES-" ]; then |
---|
17 | ConsoleMessage "Starting PostgreSQL-8" |
---|
18 | su -l postgres -c "exec /opt/local/bin/pg_ctl start -D $PGDATA -s -w" |
---|
19 | fi |
---|
20 | } |
---|
21 | |
---|
22 | StopService () |
---|
23 | { |
---|
24 | ConsoleMessage "Stopping PostgreSQL-8" |
---|
25 | su -l postgres -c "exec /opt/local/bin/pg_ctl stop -D $PGDATA -s -m fast" |
---|
26 | } |
---|
27 | |
---|
28 | RestartService () |
---|
29 | { |
---|
30 | if [ "${POSTGRESQL8:=-NO-}" = "-YES-" ]; then |
---|
31 | ConsoleMessage "Restarting PostgreSQL-8" |
---|
32 | su -l postgres -c "exec /opt/local/bin/pg_ctl restart -D $PGDATA -s -m fast" |
---|
33 | fi |
---|
34 | } |
---|
35 | |
---|
36 | RunService "$1" |
---|