]>
Commit | Line | Data |
---|---|---|
ad2e796d PS |
1 | #!/bin/sh |
2 | # | |
3 | # start postgresql | |
4 | # | |
5 | ||
6 | umask 077 | |
7 | ||
8 | if [ ! -f /var/lib/pgsql/PG_VERSION ]; then | |
9 | echo "Initializing postgresql data base..." | |
10 | su - postgres -c '/usr/bin/pg_ctl initdb -D /var/lib/pgsql' | |
11 | echo "done" | |
12 | fi | |
13 | ||
14 | start() { | |
0f75b263 | 15 | printf "Starting postgresql: " |
e7d515d0 | 16 | su - postgres -c '/usr/bin/pg_ctl start -w -D /var/lib/pgsql -l logfile' |
ad2e796d PS |
17 | echo "OK" |
18 | } | |
19 | stop() { | |
0f75b263 | 20 | printf "Stopping postgresql: " |
ad2e796d PS |
21 | su - postgres -c '/usr/bin/pg_ctl stop -D /var/lib/pgsql -m fast' |
22 | echo "OK" | |
23 | } | |
24 | restart() { | |
25 | stop | |
26 | start | |
27 | } | |
28 | ||
29 | case "$1" in | |
30 | start) | |
31 | start | |
32 | ;; | |
33 | stop) | |
34 | stop | |
35 | ;; | |
36 | restart|reload) | |
37 | restart | |
38 | ;; | |
39 | *) | |
40 | echo "Usage: $0 {start|stop|restart}" | |
41 | exit 1 | |
42 | esac | |
43 | ||
44 | exit $? |