diff options
author | Jason Wessel <jason.wessel@windriver.com> | 2013-11-11 14:59:55 -0600 |
---|---|---|
committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2013-11-25 15:25:37 -0500 |
commit | 467b613638a0208cfbaaab5d54e07431255408fa (patch) | |
tree | f05f7067bf51de5d1a0668be72c3308d0e25dd9f /meta-openstack/recipes-support/postgresql | |
parent | 53bb70159334a0219b3212ddfb5027b1b571b3a7 (diff) | |
download | meta-cloud-services-467b613638a0208cfbaaab5d54e07431255408fa.tar.gz |
postgresql: Fix init to work with postgresql in a drbd data container
When postgresql installed on the target and configured with drbd the
data will live in the drbd container and the startup script must
account for the different invocation to pg_ctl, as well as checking
that the config files are properly linked into to the postgresql data
directory.
The set -e was removed because the script was exiting improperly
during the restart operation and status operations.
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-support/postgresql')
-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 |