Issue #2182 - PostgreSQL port is now configurable in postgresql.conf; Java path is no longer relative in wrapper.conf

Amend: wrap file access in try..finally; move StringBuilder outside of a loop

Change-Id: Iafa7493ef79a0a891f36923f1695cefdb47e16da

Former-commit-id: 0c3b22c8f2 [formerly 43008f4698] [formerly 0c3b22c8f2 [formerly 43008f4698] [formerly 120ebd045a [formerly 71f74d7b8125994537ef5520fe59134a7f86e9af]]]
Former-commit-id: 120ebd045a
Former-commit-id: 68181d3f62 [formerly fac9d72cc8]
Former-commit-id: 9e0e6662c8
This commit is contained in:
Bryan Kowal 2013-12-12 10:32:22 -06:00
parent 4bd12a5840
commit fad82481c1
12 changed files with 643 additions and 563 deletions

View file

@ -4,6 +4,7 @@
<property name="src" value="src"></property> <property name="src" value="src"></property>
<property name="db.mach.name" value="localhost"/> <property name="db.mach.name" value="localhost"/>
<property name="database" value="hd_ob83krf" /> <property name="database" value="hd_ob83krf" />
<property name="database.port" value="5432" />
<target name="runJDbGen"> <target name="runJDbGen">
@ -12,7 +13,7 @@
<pathelement location="./bin"/> <pathelement location="./bin"/>
<pathelement path="${basedir}/REQUIRED_JARS/postgresql-8.3-603.jdbc3.jar"/> <pathelement path="${basedir}/REQUIRED_JARS/postgresql-8.3-603.jdbc3.jar"/>
</classpath> </classpath>
<arg value="jdbc:postgresql://${db.mach.name}:5432/${database}?user=awips"/> <!-- connectionURL --> <arg value="jdbc:postgresql://${db.mach.name}:${database.port}/${database}?user=awips"/> <!-- connectionURL -->
<arg value="${basedir}/PreferredTableNames.txt"/> <!--preferredTableNameFilePath --> <arg value="${basedir}/PreferredTableNames.txt"/> <!--preferredTableNameFilePath -->
<arg value="${database}"/> <!-- dbName --> <arg value="${database}"/> <!-- dbName -->
<arg value="ohd.hseb.ihfsdb.generated"/> <!-- packageName --> <arg value="ohd.hseb.ihfsdb.generated"/> <!-- packageName -->

View file

@ -34,7 +34,7 @@ wrapper.fork_hack=true
wrapper.console.pipestreams=true wrapper.console.pipestreams=true
# Java Application # Java Application
wrapper.java.command=${EDEX_HOME}/../java/bin/java wrapper.java.command=${JAVA_HOME}/bin/java
# necessary for etc/init.d/edex_camel # necessary for etc/init.d/edex_camel
wrapper.pidfile=${EDEX_HOME}/bin/${EDEX_RUN_MODE}.pid wrapper.pidfile=${EDEX_HOME}/bin/${EDEX_RUN_MODE}.pid

View file

@ -65,6 +65,9 @@ import com.raytheon.wes2bridge.common.configuration.Wes2BridgeConfiguration;
* edex-environment instance * edex-environment instance
* Apr 18, 2013 1899 bkowal Updates qpid 0.18 configuration now. * Apr 18, 2013 1899 bkowal Updates qpid 0.18 configuration now.
* July 2, 2013 2133 bkowal Updates for yajsw-wrapped qpid * July 2, 2013 2133 bkowal Updates for yajsw-wrapped qpid
* Dec 11, 2013 2182 bkowal Update the postgresql port in
* postgresql.conf instead of the
* postgresql startup scripts
* *
* </pre> * </pre>
* *
@ -173,8 +176,12 @@ public class Wes2BridgeManager {
String srcsetup_env = srcEdexDirectory + "/bin/setup.env"; String srcsetup_env = srcEdexDirectory + "/bin/setup.env";
String setup_env = edexDirectory + "/bin/setup.env"; String setup_env = edexDirectory + "/bin/setup.env";
BufferedReader br = this.getBufferedReader(srcsetup_env); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(setup_env); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcsetup_env);
bw = this.getBufferedWriter(setup_env);
final String line1 = "export DATA_ARCHIVE_ROOT="; final String line1 = "export DATA_ARCHIVE_ROOT=";
final String line2 = "export DB_PORT="; final String line2 = "export DB_PORT=";
@ -194,7 +201,8 @@ public class Wes2BridgeManager {
} else if (line.startsWith(line2)) { } else if (line.startsWith(line2)) {
line = line2 + this.configuration.getDatabasePort(); line = line2 + this.configuration.getDatabasePort();
} else if (line.startsWith(line3)) { } else if (line.startsWith(line3)) {
line = line3 + "localhost:" + this.configuration.getJmsPort(); line = line3 + "localhost:"
+ this.configuration.getJmsPort();
} else if (line.startsWith(line4)) { } else if (line.startsWith(line4)) {
line = line4 + this.configuration.getEdexHttpPort(); line = line4 + this.configuration.getEdexHttpPort();
} else if (line.startsWith(line5)) { } else if (line.startsWith(line5)) {
@ -209,9 +217,11 @@ public class Wes2BridgeManager {
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
/* Disable JMX. */ /* Disable JMX. */
private void updateEdexWrapper(String srcEdexDirectory, String edexDirectory) private void updateEdexWrapper(String srcEdexDirectory, String edexDirectory)
@ -219,8 +229,11 @@ public class Wes2BridgeManager {
String srcwrapper_conf = srcEdexDirectory + "/conf/wrapper.conf"; String srcwrapper_conf = srcEdexDirectory + "/conf/wrapper.conf";
String wrapper_conf = edexDirectory + "/conf/wrapper.conf"; String wrapper_conf = edexDirectory + "/conf/wrapper.conf";
BufferedReader br = this.getBufferedReader(srcwrapper_conf); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(wrapper_conf); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcwrapper_conf);
bw = this.getBufferedWriter(wrapper_conf);
/* /*
* We want to replace at least one of the jmx jvm arguments with the * We want to replace at least one of the jmx jvm arguments with the
@ -229,9 +242,9 @@ public class Wes2BridgeManager {
boolean wes2BridgeInstanceAdded = false; boolean wes2BridgeInstanceAdded = false;
/* /*
* Disable JMX Remote and add a new wes2bridge.instance JVM argument so * Disable JMX Remote and add a new wes2bridge.instance JVM argument
* that it will be possible to determine which edex instance belongs to * so that it will be possible to determine which edex instance
* which test case. * belongs to which test case.
*/ */
/* /*
* This may apply to multiple jvm arguments including: 1) * This may apply to multiple jvm arguments including: 1)
@ -259,14 +272,17 @@ public class Wes2BridgeManager {
line += line2 + "=" + this.configuration.getWebPort(); line += line2 + "=" + this.configuration.getWebPort();
} else if (line.contains(line3)) { } else if (line.contains(line3)) {
line = this.getJVMArgumentName(line); line = this.getJVMArgumentName(line);
line += line3 + "=" + this.configuration.getConfidentialPort(); line += line3 + "="
+ this.configuration.getConfidentialPort();
} }
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
private String getJVMArgumentName(String jvmArgument) { private String getJVMArgumentName(String jvmArgument) {
if (jvmArgument == null) { if (jvmArgument == null) {
@ -289,8 +305,11 @@ public class Wes2BridgeManager {
+ "edex_camel"; + "edex_camel";
final String edex_camel = this.wes2BridgeScripts + "/edex_camel"; final String edex_camel = this.wes2BridgeScripts + "/edex_camel";
BufferedReader br = this.getBufferedReader(srcedex_camel); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(edex_camel); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcedex_camel);
bw = this.getBufferedWriter(edex_camel);
final String line1 = "EDEX_INSTALL="; final String line1 = "EDEX_INSTALL=";
final String line2 = "export DATA_ARCHIVE_ROOT="; final String line2 = "export DATA_ARCHIVE_ROOT=";
@ -311,16 +330,20 @@ public class Wes2BridgeManager {
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
public void reconfigurePostgreSQL() throws FileNotFoundException, public void reconfigurePostgreSQL() throws FileNotFoundException,
IOException { IOException {
final String postgresqlRootDirectory = WES2BRIDGE_DIRECTORY + "/" final String postgresqlRootDirectory = WES2BRIDGE_DIRECTORY
+ this.configuration.getTestCaseName(); + File.separator + this.configuration.getTestCaseName();
final String srcDataDirectory = AWIPSII + File.separator + "data";
this.updateEdexPostgres(postgresqlRootDirectory); this.updateEdexPostgres(postgresqlRootDirectory);
this.updatePostgresqlConf(srcDataDirectory);
} }
private void updateEdexPostgres(String postgresqlRootDirectory) private void updateEdexPostgres(String postgresqlRootDirectory)
@ -329,25 +352,66 @@ public class Wes2BridgeManager {
+ "edex_postgres"; + "edex_postgres";
final String edex_postgres = this.wes2BridgeScripts + "/edex_postgres"; final String edex_postgres = this.wes2BridgeScripts + "/edex_postgres";
BufferedReader br = this.getBufferedReader(srcedex_postgres); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(edex_postgres); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcedex_postgres);
bw = this.getBufferedWriter(edex_postgres);
final String line1 = "POSTGRESQL_INSTALL_ROOT="; final String line1 = "POSTGRESQL_INSTALL_ROOT=";
final String line2 = "PGPORT=";
String line = StringUtils.EMPTY; String line = StringUtils.EMPTY;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
if (line.startsWith(line1)) { if (line.startsWith(line1)) {
line = line1 + postgresqlRootDirectory; line = line1 + postgresqlRootDirectory;
} else if (line.startsWith(line2)) {
line = line2 + this.configuration.getDatabasePort();
} }
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
private void updatePostgresqlConf(String srcDataDirectory)
throws FileNotFoundException, IOException {
final String postgresqlConf = "postgresql.conf";
final String srcPostgresqlConf = srcDataDirectory + File.separator
+ postgresqlConf;
final String destPostgresqlConf = WES2BRIDGE_DIRECTORY + File.separator
+ this.configuration.getTestCaseName() + File.separator
+ "data" + File.separator + postgresqlConf;
final String regex1 = "^(port = )([0-9]+)(.+)";
final Pattern pattern1 = Pattern.compile(regex1);
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcPostgresqlConf);
bw = this.getBufferedWriter(destPostgresqlConf);
String line = StringUtils.EMPTY;
// only used once - clearing it will not be necessary
StringBuilder stringBuilder = new StringBuilder();
while ((line = br.readLine()) != null) {
Matcher matcher = pattern1.matcher(line);
if (matcher.matches()) {
stringBuilder.append(matcher.group(1));
stringBuilder.append(this.configuration.getDatabasePort());
stringBuilder.append(matcher.group(3));
line = stringBuilder.toString();
}
bw.write(line + "\n");
}
} finally {
br.close();
bw.close();
}
}
public void reconfigureQPID() throws FileNotFoundException, IOException, public void reconfigureQPID() throws FileNotFoundException, IOException,
ParserConfigurationException, SAXException, ParserConfigurationException, SAXException,
@ -437,8 +501,11 @@ public class Wes2BridgeManager {
final String srcqpidd = AWIPSII_WES2BRIDGE_SCRIPTS + "/" + "qpidd"; final String srcqpidd = AWIPSII_WES2BRIDGE_SCRIPTS + "/" + "qpidd";
final String qpidd = this.wes2BridgeScripts + "/qpidd"; final String qpidd = this.wes2BridgeScripts + "/qpidd";
BufferedReader br = this.getBufferedReader(srcqpidd); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(qpidd); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcqpidd);
bw = this.getBufferedWriter(qpidd);
final String line1 = "QPID_HOME="; final String line1 = "QPID_HOME=";
@ -450,9 +517,11 @@ public class Wes2BridgeManager {
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
/* /*
* This method will: 1) update pypies.cfg 2) update httpd.conf * This method will: 1) update pypies.cfg 2) update httpd.conf
@ -489,8 +558,11 @@ public class Wes2BridgeManager {
final String logFileDirectoryLocation = pypiesDirectory final String logFileDirectoryLocation = pypiesDirectory
+ File.separator + "logs"; + File.separator + "logs";
BufferedReader br = this.getBufferedReader(srcpypiescfg); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(pypiescfg); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcpypiescfg);
bw = this.getBufferedWriter(pypiescfg);
final String hdf5DirPattern = "(hdf5dir=).+"; final String hdf5DirPattern = "(hdf5dir=).+";
final String logFileDirPattern = "(logFileDir=).+"; final String logFileDirPattern = "(logFileDir=).+";
@ -518,10 +590,11 @@ public class Wes2BridgeManager {
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
private void updateHttpdConf(String srcHttpdPypiesDirectory, private void updateHttpdConf(String srcHttpdPypiesDirectory,
String httpdPypiesDirectory) throws FileNotFoundException, String httpdPypiesDirectory) throws FileNotFoundException,
@ -535,8 +608,11 @@ public class Wes2BridgeManager {
final String serverRoot = httpdPypiesDirectory + File.separator + "etc" final String serverRoot = httpdPypiesDirectory + File.separator + "etc"
+ File.separator + "httpd"; + File.separator + "httpd";
BufferedReader br = this.getBufferedReader(srcHttpdConf); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(httpdConf); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srcHttpdConf);
bw = this.getBufferedWriter(httpdConf);
final String listenPattern = "(Listen )[1-9][0-9]+"; final String listenPattern = "(Listen )[1-9][0-9]+";
final String serverRootPattern = "(ServerRoot \").+(\")"; final String serverRootPattern = "(ServerRoot \").+(\")";
@ -558,10 +634,11 @@ public class Wes2BridgeManager {
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
private void updateHttpdPypies(String httpdPypiesDirectory, private void updateHttpdPypies(String httpdPypiesDirectory,
String pypiesDirectory) throws IOException, FileNotFoundException { String pypiesDirectory) throws IOException, FileNotFoundException {
@ -569,15 +646,19 @@ public class Wes2BridgeManager {
+ "httpd-pypies"; + "httpd-pypies";
final String httpd_pypies = this.wes2BridgeScripts + "/httpd-pypies"; final String httpd_pypies = this.wes2BridgeScripts + "/httpd-pypies";
BufferedReader br = this.getBufferedReader(srchttpd_pypies); BufferedReader br = null;
BufferedWriter bw = this.getBufferedWriter(httpd_pypies); BufferedWriter bw = null;
try {
br = this.getBufferedReader(srchttpd_pypies);
bw = this.getBufferedWriter(httpd_pypies);
final String httpdPypiesInstallPattern = "(HTTPD_PYPIES_INSTALL=).+"; final String httpdPypiesInstallPattern = "(HTTPD_PYPIES_INSTALL=).+";
final String loggingCommandPattern = "( *nohup su awips -c \"\\$loggingCmd > /tmp/pypiesLoggingService)(.log 2>&1\" > /dev/null &)"; final String loggingCommandPattern = "( *nohup su awips -c \"\\$loggingCmd > /tmp/pypiesLoggingService)(.log 2>&1\" > /dev/null &)";
final String pypiesConfigurationPattern = "(export PYPIES_CFG=).+"; final String pypiesConfigurationPattern = "(export PYPIES_CFG=).+";
final Pattern pattern1 = Pattern.compile(httpdPypiesInstallPattern); final Pattern pattern1 = Pattern.compile(httpdPypiesInstallPattern);
final Pattern pattern2 = Pattern.compile(loggingCommandPattern); final Pattern pattern2 = Pattern.compile(loggingCommandPattern);
final Pattern pattern3 = Pattern.compile(pypiesConfigurationPattern); final Pattern pattern3 = Pattern
.compile(pypiesConfigurationPattern);
String line = StringUtils.EMPTY; String line = StringUtils.EMPTY;
while ((line = br.readLine()) != null) { while ((line = br.readLine()) != null) {
@ -600,10 +681,11 @@ public class Wes2BridgeManager {
bw.write(line + "\n"); bw.write(line + "\n");
} }
} finally {
br.close(); br.close();
bw.close(); bw.close();
} }
}
/* /*
* The following functions and usage of the following functions would no * The following functions and usage of the following functions would no

View file

@ -3,6 +3,7 @@
<property name="dist" value="dist" /> <property name="dist" value="dist" />
<property name="src" value="src" /> <property name="src" value="src" />
<property name="db.mach.name" value="localhost" /> <property name="db.mach.name" value="localhost" />
<property name="db.port" value="5432" />
<property name="database" value="hd_ob83oax" /> <property name="database" value="hd_ob83oax" />
<target name="runJDbGen" depends="prepare"> <target name="runJDbGen" depends="prepare">
@ -12,7 +13,7 @@
<pathelement location="./classes"/> <pathelement location="./classes"/>
<pathelement path="${basedir}/REQUIRED_JARS/postgresql-8.3-603.jdbc3.jar"/> <pathelement path="${basedir}/REQUIRED_JARS/postgresql-8.3-603.jdbc3.jar"/>
</classpath> </classpath>
<arg value="jdbc:postgresql://${db.mach.name}:5432/${database}?user=awips"/> <!-- connectionURL --> <arg value="jdbc:postgresql://${db.mach.name}:${db.port}/${database}?user=awips"/> <!-- connectionURL -->
<arg value="${basedir}/PreferredTableNames.txt"/> <!--preferredTableNameFilePath --> <arg value="${basedir}/PreferredTableNames.txt"/> <!--preferredTableNameFilePath -->
<arg value="${database}"/> <!-- dbName --> <arg value="${database}"/> <!-- dbName -->
<arg value="ohd.hseb.ihfsdb.generated"/> <!-- packageName --> <arg value="ohd.hseb.ihfsdb.generated"/> <!-- packageName -->

View file

@ -60,7 +60,7 @@ listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses; # comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all # defaults to 'localhost'; use '*' for all
# (change requires restart) # (change requires restart)
#port = 5432 # (change requires restart) port = 5432 # (change requires restart)
max_connections = 300 # (change requires restart) max_connections = 300 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per # Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). # connection slot, plus lock space (see max_locks_per_transaction).

View file

@ -60,7 +60,7 @@ listen_addresses = '*' # what IP address(es) to listen on;
# comma-separated list of addresses; # comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all # defaults to 'localhost'; use '*' for all
# (change requires restart) # (change requires restart)
#port = 5432 # (change requires restart) port = 5432 # (change requires restart)
max_connections = 300 # (change requires restart) max_connections = 300 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per # Note: Increasing max_connections costs ~400 bytes of shared memory per
# connection slot, plus lock space (see max_locks_per_transaction). # connection slot, plus lock space (see max_locks_per_transaction).

View file

@ -7,7 +7,7 @@
Summary: Pypies Apache HTTP Server Summary: Pypies Apache HTTP Server
Name: awips2-httpd-pypies Name: awips2-httpd-pypies
Version: 2.2.15 Version: 2.2.15
Release: 15.3.el6 Release: 15.3-1.el6
URL: http://httpd.apache.org/ URL: http://httpd.apache.org/
Source0: http://archive.apache.org/dist/httpd/httpd-%{version}.tar.gz Source0: http://archive.apache.org/dist/httpd/httpd-%{version}.tar.gz
Source1: index.html Source1: index.html

View file

@ -100,7 +100,9 @@ start() {
stop() { stop() {
echo -n $"Stopping $prog: " echo -n $"Stopping $prog: "
/awips2/httpd_pypies/usr/sbin/apachectl -k graceful-stop ${HTTPD_PYPIES_INSTALL}/usr/sbin/apachectl -f \
${HTTPD_PYPIES_INSTALL}/etc/httpd/conf/httpd.conf \
-k graceful-stop
RETVAL=$? RETVAL=$?
echo echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
@ -148,7 +150,9 @@ reload() {
echo $"not reloading due to configuration syntax error" echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error" failure $"not reloading $httpd due to configuration syntax error"
else else
/awips2/httpd_pypies/usr/sbin/apachectl -k graceful ${HTTPD_PYPIES_INSTALL}/usr/sbin/apachectl -f \
${HTTPD_PYPIES_INSTALL}/etc/httpd/conf/httpd.conf \
-k graceful
RETVAL=$? RETVAL=$?
fi fi
echo echo

View file

@ -8,7 +8,7 @@
Name: awips2-postgresql Name: awips2-postgresql
Summary: AWIPS II PostgreSQL Distribution Summary: AWIPS II PostgreSQL Distribution
Version: %{_postgresql_version} Version: %{_postgresql_version}
Release: 1.el6 Release: 2.el6
Group: AWIPSII Group: AWIPSII
BuildRoot: %{_build_root} BuildRoot: %{_build_root}
BuildArch: %{_build_arch} BuildArch: %{_build_arch}

View file

@ -36,8 +36,6 @@ PGDATA_DIR="${POSTGRESQL_INSTALL_ROOT}/data"
PGDATA="${PGDATA_DIR}" PGDATA="${PGDATA_DIR}"
# Who to run the postmaster as, usually "postgres". (NOT "root") # Who to run the postmaster as, usually "postgres". (NOT "root")
PGUSER=awips PGUSER=awips
# Port to start the database with
PGPORT=5432
# Where to keep a log file # Where to keep a log file
PGLOG="$PGDATA/serverlog" PGLOG="$PGDATA/serverlog"
# The path that is to be used for the script # The path that is to be used for the script
@ -57,29 +55,29 @@ PGCTL="${POSTGRESQL_INSTALL}/bin/pg_ctl"
case $1 in case $1 in
start) start)
echo -n "Starting EDEX PostgreSQL: " echo -n "Starting EDEX PostgreSQL: "
su $PGUSER -c "$DAEMON -D '$PGDATA' -p $PGPORT &" >>$PGLOG 2>&1 su $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
echo echo
RETVAL=$? RETVAL=$?
;; ;;
stop) stop)
echo -n "Stopping EDEX PostgreSQL: " echo -n "Stopping EDEX PostgreSQL: "
su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -o \"-p $PGPORT\"" su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast"
echo echo
RETVAL=$? RETVAL=$?
;; ;;
restart) restart)
echo -n "Restarting EDEX PostgreSQL: " echo -n "Restarting EDEX PostgreSQL: "
su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w -o \"-p $PGPORT\"" su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w"
su $PGUSER -c "$DAEMON -D '$PGDATA' -p $PGPORT &" >>$PGLOG 2>&1 su $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1
RETVAL=$? RETVAL=$?
;; ;;
reload) reload)
echo -n "Reload EDEX PostgreSQL: " echo -n "Reload EDEX PostgreSQL: "
su $PGUSER -c "$PGCTL reload -D '$PGDATA' -s -o \"-p $PGPORT\"" su $PGUSER -c "$PGCTL reload -D '$PGDATA' -s"
RETVAL=$? RETVAL=$?
;; ;;
status) status)
su $PGUSER -c "$PGCTL status -D '$PGDATA' -o \"-p $PGPORT\"" su $PGUSER -c "$PGCTL status -D '$PGDATA'"
;; ;;
*) *)
# Print help # Print help

View file

@ -11,9 +11,6 @@ prefix="${POSTGRESQL_INSTALL}/postgresql"
# Data Directory # Data Directory
PGDATA="${POSTGRESQL_INSTALL}/data" PGDATA="${POSTGRESQL_INSTALL}/data"
# Port to start the database with
PGPORT=5432
# Where to keep a log file # Where to keep a log file
PGLOG="$PGDATA/serverlog" PGLOG="$PGDATA/serverlog"
@ -40,7 +37,7 @@ set -e
test -x $DAEMON || exit 0 test -x $DAEMON || exit 0
echo -n "Starting PostgreSQL: " echo -n "Starting PostgreSQL: "
$DAEMON -D $PGDATA -p $PGPORT $DAEMON -D $PGDATA

View file

@ -11,9 +11,6 @@ prefix="${POSTGRESQL_INSTALL}/postgresql"
# Data Directory # Data Directory
PGDATA="${POSTGRESQL_INSTALL}/data" PGDATA="${POSTGRESQL_INSTALL}/data"
# Port to start the database with
PGPORT=5432
# Where to keep a log file # Where to keep a log file
PGLOG="$PGDATA/serverlog" PGLOG="$PGDATA/serverlog"
@ -40,7 +37,7 @@ set -e
test -x $DAEMON || exit 0 test -x $DAEMON || exit 0
echo -n "Starting PostgreSQL: " echo -n "Starting PostgreSQL: "
$DAEMON -D $PGDATA -p $PGPORT $DAEMON -D $PGDATA