diff options
-rw-r--r-- | meta-openstack/recipes-support/postgresql/postgresql/postgresql | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/meta-openstack/recipes-support/postgresql/postgresql/postgresql b/meta-openstack/recipes-support/postgresql/postgresql/postgresql index a6b302b..74f7e2d 100644 --- a/meta-openstack/recipes-support/postgresql/postgresql/postgresql +++ b/meta-openstack/recipes-support/postgresql/postgresql/postgresql | |||
@@ -1,5 +1,4 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | set -e | ||
3 | 2 | ||
4 | ### BEGIN INIT INFO | 3 | ### BEGIN INIT INFO |
5 | # Provides: postgresql | 4 | # Provides: postgresql |
@@ -15,6 +14,19 @@ set -e | |||
15 | DAEMON=/usr/bin/postmaster | 14 | DAEMON=/usr/bin/postmaster |
16 | DESC="PostgreSQL RDBMS server" | 15 | DESC="PostgreSQL RDBMS server" |
17 | 16 | ||
17 | datadir=`grep ^data_directory /etc/postgresql/postgresql.conf |sed -e "s#^.*= '##; s#'.*##"` | ||
18 | if [ "$datadir" = "" ] ; then | ||
19 | datadir=/etc/postgresql | ||
20 | else | ||
21 | if [ ! -e $datadir/postgresql.conf ] ; then | ||
22 | if [ -e /etc/postgresql/postgresql.conf -a -e $datadir ] ; then | ||
23 | ln -s /etc/postgresql/*.conf $datadir/ | ||
24 | fi | ||
25 | fi | ||
26 | fi | ||
27 | |||
28 | cd / | ||
29 | |||
18 | start () | 30 | start () |
19 | { | 31 | { |
20 | echo -n "Starting postgres server..." | 32 | echo -n "Starting postgres server..." |
@@ -24,7 +36,7 @@ start () | |||
24 | fi | 36 | fi |
25 | touch /var/log/postgresql.log | 37 | touch /var/log/postgresql.log |
26 | chown postgres /var/log/postgresql.log | 38 | chown postgres /var/log/postgresql.log |
27 | sudo -u postgres /usr/bin/pg_ctl start -w -D /etc/postgresql -s -l /var/log/postgresql.log | 39 | sudo -u postgres /usr/bin/pg_ctl start -w -D $datadir -s -l /var/log/postgresql.log |
28 | if [ $? -eq 0 ]; then | 40 | if [ $? -eq 0 ]; then |
29 | echo "done." | 41 | echo "done." |
30 | else | 42 | else |
@@ -39,7 +51,7 @@ stop () | |||
39 | echo "not running." | 51 | echo "not running." |
40 | exit 0 | 52 | exit 0 |
41 | fi | 53 | fi |
42 | sudo -u postgres /usr/bin/pg_ctl stop -w -D /etc/postgresql -m fast -s | 54 | sudo -u postgres /usr/bin/pg_ctl stop -w -D $datadir -m fast -s |
43 | if [ $? -eq 0 ]; then | 55 | if [ $? -eq 0 ]; then |
44 | echo "done." | 56 | echo "done." |
45 | else | 57 | else |