From c8e49142f251e325077590f12d0ef7a41115b93d Mon Sep 17 00:00:00 2001 From: Bryan Kowal Date: Thu, 12 Dec 2013 10:32:22 -0600 Subject: [PATCH] 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: b2550c873b296113cc114a463fa3e4776bf7828a [formerly 0c3b22c8f2a7a9c5ca729ac3f462970fb1ed7a9b] [formerly 43008f46982f66001e6a480d2771a77d85b41533] [formerly b2550c873b296113cc114a463fa3e4776bf7828a [formerly 0c3b22c8f2a7a9c5ca729ac3f462970fb1ed7a9b] [formerly 43008f46982f66001e6a480d2771a77d85b41533] [formerly 120ebd045a5508b906cd22682f66cfd1a0cb324f [formerly 43008f46982f66001e6a480d2771a77d85b41533 [formerly 71f74d7b8125994537ef5520fe59134a7f86e9af]]]] Former-commit-id: 120ebd045a5508b906cd22682f66cfd1a0cb324f Former-commit-id: a63bda59b423c3c1339e73dea67a547339b3c50c [formerly 68181d3f62d5c9e905390c5ebdf9f519d7985fab] [formerly 1ab6f3920db4e2de42353fe97a9c4fe694df0851 [formerly fac9d72cc852ab18922a8cc92342af58d614d9f6]] Former-commit-id: ea54fc6cf0eb39a2eb253d886a1e3180ccf382a0 [formerly 9e0e6662c8b472e3b30aac2aded987682f025ec6] Former-commit-id: fad82481c157adcd7d7580294b71c980ae216cae --- cave/ohd.hseb.ihfsdb/build.xml | 3 +- edexOsgi/build.edex/esb/conf/wrapper.conf | 2 +- .../wes2bridge/manager/Wes2BridgeManager.java | 1156 +++++++++-------- javaUtilities/hydro/ohd.ihfsdb/generate.xml | 3 +- .../configuration/postgresql.conf | 2 +- .../configuration/postgresql.conf | 2 +- .../Installer.httpd-pypies/component.spec | 2 +- .../configuration/etc/init.d/httpd-pypies | 10 +- .../Installer.postgres/component.spec | 2 +- .../scripts/init.d/edex_postgres | 14 +- .../scripts/start_developer_postgres.sh | 5 +- .../scripts/start_postgres.sh | 5 +- 12 files changed, 643 insertions(+), 563 deletions(-) diff --git a/cave/ohd.hseb.ihfsdb/build.xml b/cave/ohd.hseb.ihfsdb/build.xml index 84dc60b0cf..2cf757138c 100644 --- a/cave/ohd.hseb.ihfsdb/build.xml +++ b/cave/ohd.hseb.ihfsdb/build.xml @@ -4,6 +4,7 @@ + @@ -12,7 +13,7 @@ - + diff --git a/edexOsgi/build.edex/esb/conf/wrapper.conf b/edexOsgi/build.edex/esb/conf/wrapper.conf index a98c8ef75d..4fd3dc3e13 100644 --- a/edexOsgi/build.edex/esb/conf/wrapper.conf +++ b/edexOsgi/build.edex/esb/conf/wrapper.conf @@ -34,7 +34,7 @@ wrapper.fork_hack=true wrapper.console.pipestreams=true # Java Application -wrapper.java.command=${EDEX_HOME}/../java/bin/java +wrapper.java.command=${JAVA_HOME}/bin/java # necessary for etc/init.d/edex_camel wrapper.pidfile=${EDEX_HOME}/bin/${EDEX_RUN_MODE}.pid diff --git a/javaUtilities/com.raytheon.wes2bridge.manager/src/com/raytheon/wes2bridge/manager/Wes2BridgeManager.java b/javaUtilities/com.raytheon.wes2bridge.manager/src/com/raytheon/wes2bridge/manager/Wes2BridgeManager.java index e1662dc0f7..b18577e5d6 100644 --- a/javaUtilities/com.raytheon.wes2bridge.manager/src/com/raytheon/wes2bridge/manager/Wes2BridgeManager.java +++ b/javaUtilities/com.raytheon.wes2bridge.manager/src/com/raytheon/wes2bridge/manager/Wes2BridgeManager.java @@ -65,6 +65,9 @@ import com.raytheon.wes2bridge.common.configuration.Wes2BridgeConfiguration; * edex-environment instance * Apr 18, 2013 1899 bkowal Updates qpid 0.18 configuration now. * 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 * * * @@ -72,553 +75,632 @@ import com.raytheon.wes2bridge.common.configuration.Wes2BridgeConfiguration; * @version 1.0 */ public class Wes2BridgeManager { - private static final String AWIPSII = "/awips2"; + private static final String AWIPSII = "/awips2"; - private static final String AWIPSII_WES2BRIDGE_SCRIPTS = AWIPSII - + "/edex-environment/scripts"; + private static final String AWIPSII_WES2BRIDGE_SCRIPTS = AWIPSII + + "/edex-environment/scripts"; - private static final String WES2BRIDGE_DIRECTORY = "/usr/local/edex-environment"; + private static final String WES2BRIDGE_DIRECTORY = "/usr/local/edex-environment"; - private static final int GROUP_INDEX_ONE = 1; + private static final int GROUP_INDEX_ONE = 1; - private static final int GROUP_INDEX_TWO = 2; + private static final int GROUP_INDEX_TWO = 2; - private static final int EXIT_FAILURE = -1; + private static final int EXIT_FAILURE = -1; - private static final int EXIT_SUCCESS = 0; + private static final int EXIT_SUCCESS = 0; - private static final String DEFAULT_HDF5_DIRECTORY = "/edex/data/hdf5"; + private static final String DEFAULT_HDF5_DIRECTORY = "/edex/data/hdf5"; - private Wes2BridgeConfiguration configuration = null; + private Wes2BridgeConfiguration configuration = null; - private String wes2BridgeScripts = null; + private String wes2BridgeScripts = null; - /** + /** * */ - public Wes2BridgeManager() { - } - - /** - * @param args - */ - public static void main(String[] args) { - if (args.length != 1) { - System.out - .println("ERROR: The configuration file has not been specified."); - System.exit(EXIT_FAILURE); - } - - Wes2BridgeManager manager = new Wes2BridgeManager(); - try { - manager.init(args[0]); - } catch (Exception e1) { - e1.printStackTrace(); - System.exit(EXIT_FAILURE); - } - - try { - manager.reconfigureEdex(); - } catch (Exception e1) { - e1.printStackTrace(); - System.exit(EXIT_FAILURE); - } - - try { - manager.reconfigurePostgreSQL(); - } catch (Exception e1) { - e1.printStackTrace(); - System.exit(EXIT_FAILURE); - } - - try { - manager.reconfigureQPID(); - } catch (Exception e1) { - e1.printStackTrace(); - System.exit(EXIT_FAILURE); - } - - try { - manager.reconfigurePypies(); - } catch (Exception e1) { - e1.printStackTrace(); - System.exit(EXIT_FAILURE); - } - - System.exit(EXIT_SUCCESS); - } - - public void init(String arg1) throws ConfigurationException { - configuration = new Wes2BridgeConfiguration(arg1); - configuration.init(); - this.wes2BridgeScripts = WES2BRIDGE_DIRECTORY + "/" - + configuration.getTestCaseName() + "/" + "edex-environment"; - } - - /* - * Updates setup.env and wrapper.conf. - */ - public void reconfigureEdex() throws FileNotFoundException, IOException { - final String srcEdexDirectory = AWIPSII + "/" + "edex"; - final String edexDirectory = WES2BRIDGE_DIRECTORY + "/" - + this.configuration.getTestCaseName() + "/" + "edex"; - - this.updateEdexSetup(srcEdexDirectory, edexDirectory); - this.updateEdexWrapper(srcEdexDirectory, edexDirectory); - this.updateEdexCamel(edexDirectory); - } - - private void updateEdexSetup(String srcEdexDirectory, String edexDirectory) - throws FileNotFoundException, IOException, IllegalStateException { - String srcsetup_env = srcEdexDirectory + "/bin/setup.env"; - String setup_env = edexDirectory + "/bin/setup.env"; - - BufferedReader br = this.getBufferedReader(srcsetup_env); - BufferedWriter bw = this.getBufferedWriter(setup_env); - - final String line1 = "export DATA_ARCHIVE_ROOT="; - final String line2 = "export DB_PORT="; - final String line3 = "export BROKER_ADDR="; - final String line4 = "export HTTP_PORT="; - final String line5 = "export JMS_SERVER="; - final String line6 = "export SHARE_DIR="; - final String pypiesServerPattern = "(export PYPIES_SERVER=http://.+:)[1-9][0-9]+"; - final Pattern pattern7 = Pattern.compile(pypiesServerPattern); - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - Matcher matcher = pattern7.matcher(line); - - if (line.startsWith(line1)) { - line = line1 + this.configuration.getDataArchiveRoot(); - } else if (line.startsWith(line2)) { - line = line2 + this.configuration.getDatabasePort(); - } else if (line.startsWith(line3)) { - line = line3 + "localhost:" + this.configuration.getJmsPort(); - } else if (line.startsWith(line4)) { - line = line4 + this.configuration.getEdexHttpPort(); - } else if (line.startsWith(line5)) { - line = line5 + "tcp://localhost:" - + this.configuration.getJmsPort(); - } else if (line.startsWith(line6)) { - line = line6 + edexDirectory + "/data/share"; - } else if (matcher.matches()) { - line = matcher.group(GROUP_INDEX_ONE) - + this.configuration.getHttpdPypiesPort(); - } - - bw.write(line + "\n"); - } - br.close(); - bw.close(); - } - - /* Disable JMX. */ - private void updateEdexWrapper(String srcEdexDirectory, String edexDirectory) - throws FileNotFoundException, IOException { - String srcwrapper_conf = srcEdexDirectory + "/conf/wrapper.conf"; - String wrapper_conf = edexDirectory + "/conf/wrapper.conf"; - - BufferedReader br = this.getBufferedReader(srcwrapper_conf); - BufferedWriter bw = this.getBufferedWriter(wrapper_conf); - - /* - * We want to replace at least one of the jmx jvm arguments with the - * wes2bridge.instance argument. - */ - boolean wes2BridgeInstanceAdded = false; - - /* - * Disable JMX Remote and add a new wes2bridge.instance JVM argument so - * that it will be possible to determine which edex instance belongs to - * which test case. - */ - /* - * This may apply to multiple jvm arguments including: 1) - * -Dcom.sun.management.jmxremote.port 2) - * -Dcom.sun.management.jmxremote.authenticate 3) - * -Dcom.sun.management.jmxremote.ssl - */ - final String line1 = "-Dcom.sun.management.jmxremote"; - /* Set the web port; used by uengine spring. */ - final String line2 = "-Dweb.port"; - /* Set the confidential port; used by uengine spring. */ - final String line3 = "-Dconfidential.port"; - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - if (line.contains(line1)) { - line = this.getJVMArgumentName(line); - if (wes2BridgeInstanceAdded == false) { - line += "-Dwes2bridge.instance=" - + this.configuration.getTestCaseName(); - wes2BridgeInstanceAdded = true; - } - } else if (line.contains(line2)) { - line = this.getJVMArgumentName(line); - line += line2 + "=" + this.configuration.getWebPort(); - } else if (line.contains(line3)) { - line = this.getJVMArgumentName(line); - line += line3 + "=" + this.configuration.getConfidentialPort(); - } - - bw.write(line + "\n"); - } - br.close(); - bw.close(); - } - - private String getJVMArgumentName(String jvmArgument) { - if (jvmArgument == null) { - System.out.println("ERROR: Invalid wrapper.conf file."); - System.exit(EXIT_FAILURE); - } - - String[] splitJVMArg = jvmArgument.split("="); - if (splitJVMArg.length <= 0) { - System.out.println("ERROR: Invalid wrapper.conf file."); - System.exit(EXIT_FAILURE); - } - - return splitJVMArg[0] + "="; - } - - private void updateEdexCamel(String edexDirectory) - throws FileNotFoundException, IOException { - final String srcedex_camel = AWIPSII_WES2BRIDGE_SCRIPTS + "/" - + "edex_camel"; - final String edex_camel = this.wes2BridgeScripts + "/edex_camel"; - - BufferedReader br = this.getBufferedReader(srcedex_camel); - BufferedWriter bw = this.getBufferedWriter(edex_camel); - - final String line1 = "EDEX_INSTALL="; - final String line2 = "export DATA_ARCHIVE_ROOT="; - final String line3 = "CAMELPROCESS=`ps -ef | grep \"aw.site.identifier\"|grep -c \"edex.run.mode=${1} \" `"; - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - if (line.trim().startsWith(line1)) { - line = line1 + edexDirectory; - } else if (line.trim().startsWith(line2)) { - line = line2 + this.configuration.getDataArchiveRoot(); - } else if (line.trim().startsWith(line3)) { - line = "CAMELPROCESS=`ps -ef | " - + "grep \"wes2bridge.instance=" - + this.configuration.getTestCaseName() + "\" | " - + "grep -c \"edex.run.mode=${1} \" `"; - } - - bw.write(line + "\n"); - } - br.close(); - bw.close(); - } - - public void reconfigurePostgreSQL() throws FileNotFoundException, - IOException { - final String postgresqlRootDirectory = WES2BRIDGE_DIRECTORY + "/" - + this.configuration.getTestCaseName(); - - this.updateEdexPostgres(postgresqlRootDirectory); - } - - private void updateEdexPostgres(String postgresqlRootDirectory) - throws FileNotFoundException, IOException { - final String srcedex_postgres = AWIPSII_WES2BRIDGE_SCRIPTS + "/" - + "edex_postgres"; - final String edex_postgres = this.wes2BridgeScripts + "/edex_postgres"; - - BufferedReader br = this.getBufferedReader(srcedex_postgres); - BufferedWriter bw = this.getBufferedWriter(edex_postgres); - - final String line1 = "POSTGRESQL_INSTALL_ROOT="; - final String line2 = "PGPORT="; - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - if (line.startsWith(line1)) { - line = line1 + postgresqlRootDirectory; - } else if (line.startsWith(line2)) { - line = line2 + this.configuration.getDatabasePort(); - } - - bw.write(line + "\n"); - } - br.close(); - bw.close(); - } - - public void reconfigureQPID() throws FileNotFoundException, IOException, - ParserConfigurationException, SAXException, - TransformerFactoryConfigurationError, TransformerException { - final String srcQpidDirectory = AWIPSII + "/" + "qpid"; - final String qpidDirectory = WES2BRIDGE_DIRECTORY + "/" - + this.configuration.getTestCaseName() + "/" + "qpid"; - - this.updateQpidConfigXML(srcQpidDirectory, qpidDirectory); - this.updateQPIDD(qpidDirectory); - } - - /* Updates qpid config.xml */ - private void updateQpidConfigXML(String srcQpidDirectory, - String qpidDirectory) throws FileNotFoundException, IOException, - ParserConfigurationException, SAXException, - TransformerFactoryConfigurationError, TransformerException { - String srcconfig_xml = srcQpidDirectory + "/etc/config.xml"; - String config_xml = qpidDirectory + "/etc/config.xml"; - - DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance() - .newDocumentBuilder(); - Document document = documentBuilder.parse(srcconfig_xml); - - // Get the root broker node. - Node brokerNode = document.getElementsByTagName( - IQpidConfigurationXML.XML_BROKER).item(0); - // Get the connector node. - Node connectorNode = this.getChildNodeByName(brokerNode, - IQpidConfigurationXML.XML_CONNECTOR); - // Get the management node. - Node managementNode = this.getChildNodeByName(brokerNode, - IQpidConfigurationXML.XML_MANAGEMENT); - // Get the jmxport node. - Node jmxPortNode = this.getChildNodeByName(managementNode, - IQpidConfigurationXML.XML_JMXPORT); - // Get the http port node. - Node httpPortNode = this.getChildNodeByName(managementNode, - IQpidConfigurationXML.XML_HTTP); - - Node portNode = null; - - // Get the connector port node. - portNode = this.getChildNodeByName(connectorNode, - IQpidConfigurationXML.XML_PORT); - portNode.setTextContent(Integer.toString(this.configuration - .getJmsPort())); - // Get the jmxport registryServer node - portNode = this.getChildNodeByName(jmxPortNode, - IQpidConfigurationXML.XML_REGISTRY_SERVER); - portNode.setTextContent(Integer.toString(this.configuration - .getQpidJmxPort())); - // Get the http port node. - portNode = this.getChildNodeByName(httpPortNode, - IQpidConfigurationXML.XML_PORT); - portNode.setTextContent(Integer.toString(this.configuration - .getQpidHttpPort())); - - /* - * Write the updated configuration file to its destination. - */ - Transformer transformer = TransformerFactory.newInstance() - .newTransformer(); - DOMSource domSource = new DOMSource(document); - StreamResult streamResult = new StreamResult(new File(config_xml)); - transformer.transform(domSource, streamResult); - } - - private Node getChildNodeByName(Node parentNode, String childName) { - if (parentNode.hasChildNodes() == false) { - return null; - } - - NodeList nodeList = parentNode.getChildNodes(); - for (int i = 0; i < nodeList.getLength(); i++) { - Node node = nodeList.item(i); - if (node.getNodeName().equals(childName)) { - return node; - } - } - - return null; - } - - private void updateQPIDD(String qpidDirectory) - throws FileNotFoundException, IOException { - final String srcqpidd = AWIPSII_WES2BRIDGE_SCRIPTS + "/" + "qpidd"; - final String qpidd = this.wes2BridgeScripts + "/qpidd"; - - BufferedReader br = this.getBufferedReader(srcqpidd); - BufferedWriter bw = this.getBufferedWriter(qpidd); - - final String line1 = "QPID_HOME="; - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - if (line.startsWith(line1)) { - line = line1 + qpidDirectory; - } - - bw.write(line + "\n"); - } - br.close(); - bw.close(); - } - - /* - * This method will: 1) update pypies.cfg 2) update httpd.conf - */ - public void reconfigurePypies() throws FileNotFoundException, IOException { - final String srcPypiesDirectory = AWIPSII + File.separator + "pypies"; - final String pypiesDirectory = WES2BRIDGE_DIRECTORY + File.separator - + this.configuration.getTestCaseName() + File.separator - + "pypies"; - - final String srcHttpdPypiesDirectory = AWIPSII + File.separator - + "httpd_pypies"; - final String httpdPypiesDirectory = WES2BRIDGE_DIRECTORY - + File.separator + this.configuration.getTestCaseName() - + File.separator + "httpd_pypies"; - - this.updatePypiesCfg(srcPypiesDirectory, pypiesDirectory); - this.updateHttpdConf(srcHttpdPypiesDirectory, httpdPypiesDirectory); - this.updateHttpdPypies(httpdPypiesDirectory, pypiesDirectory); - } - - private void updatePypiesCfg(String srcPypiesDirectory, - String pypiesDirectory) throws FileNotFoundException, IOException, - IllegalArgumentException { - final String pypiesCfgPathSuffix = File.separator + "conf" - + File.separator + "pypies.cfg"; - final String srcpypiescfg = srcPypiesDirectory + pypiesCfgPathSuffix; - final String pypiescfg = pypiesDirectory + pypiesCfgPathSuffix; - - // use the default location for the hdf5 root - final String hdf5DirectoryLocation = WES2BRIDGE_DIRECTORY - + File.separator + this.configuration.getTestCaseName() - + DEFAULT_HDF5_DIRECTORY; - final String logFileDirectoryLocation = pypiesDirectory - + File.separator + "logs"; - - BufferedReader br = this.getBufferedReader(srcpypiescfg); - BufferedWriter bw = this.getBufferedWriter(pypiescfg); - - final String hdf5DirPattern = "(hdf5dir=).+"; - final String logFileDirPattern = "(logFileDir=).+"; - final String loggingPortPattern = "(logging_port=)[1-9][0-9]+"; - final Pattern pattern1 = Pattern.compile(hdf5DirPattern); - final Pattern pattern2 = Pattern.compile(logFileDirPattern); - final Pattern pattern3 = Pattern.compile(loggingPortPattern); - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - Matcher matcher1 = pattern1.matcher(line); - Matcher matcher2 = pattern2.matcher(line); - Matcher matcher3 = pattern3.matcher(line); - - if (matcher1.matches()) { - line = matcher1.group(GROUP_INDEX_ONE); - line += hdf5DirectoryLocation; - } else if (matcher2.matches()) { - line = matcher2.group(GROUP_INDEX_ONE); - line += logFileDirectoryLocation; - } else if (matcher3.matches()) { - line = matcher3.group(GROUP_INDEX_ONE); - line += this.configuration.getPypiesLoggingPort(); - } - - bw.write(line + "\n"); - } - - br.close(); - bw.close(); - } - - private void updateHttpdConf(String srcHttpdPypiesDirectory, - String httpdPypiesDirectory) throws FileNotFoundException, - IOException { - final String httpdConfPathSuffix = File.separator + "etc" - + File.separator + "httpd" + File.separator + "conf" - + File.separator + "httpd.conf"; - final String srcHttpdConf = srcHttpdPypiesDirectory - + httpdConfPathSuffix; - final String httpdConf = httpdPypiesDirectory + httpdConfPathSuffix; - final String serverRoot = httpdPypiesDirectory + File.separator + "etc" - + File.separator + "httpd"; - - BufferedReader br = this.getBufferedReader(srcHttpdConf); - BufferedWriter bw = this.getBufferedWriter(httpdConf); - - final String listenPattern = "(Listen )[1-9][0-9]+"; - final String serverRootPattern = "(ServerRoot \").+(\")"; - final Pattern pattern1 = Pattern.compile(listenPattern); - final Pattern pattern2 = Pattern.compile(serverRootPattern); - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - Matcher matcher1 = pattern1.matcher(line); - Matcher matcher2 = pattern2.matcher(line); - if (matcher1.matches()) { - line = matcher1.group(GROUP_INDEX_ONE); - line += this.configuration.getHttpdPypiesPort(); - } else if (matcher2.matches()) { - line = matcher2.group(GROUP_INDEX_ONE); - line += serverRoot; - line += matcher2.group(GROUP_INDEX_TWO); - } - - bw.write(line + "\n"); - } - - br.close(); - bw.close(); - } - - private void updateHttpdPypies(String httpdPypiesDirectory, - String pypiesDirectory) throws IOException, FileNotFoundException { - final String srchttpd_pypies = AWIPSII_WES2BRIDGE_SCRIPTS + "/" - + "httpd-pypies"; - final String httpd_pypies = this.wes2BridgeScripts + "/httpd-pypies"; - - BufferedReader br = this.getBufferedReader(srchttpd_pypies); - BufferedWriter bw = this.getBufferedWriter(httpd_pypies); - - final String httpdPypiesInstallPattern = "(HTTPD_PYPIES_INSTALL=).+"; - final String loggingCommandPattern = "( *nohup su awips -c \"\\$loggingCmd > /tmp/pypiesLoggingService)(.log 2>&1\" > /dev/null &)"; - final String pypiesConfigurationPattern = "(export PYPIES_CFG=).+"; - final Pattern pattern1 = Pattern.compile(httpdPypiesInstallPattern); - final Pattern pattern2 = Pattern.compile(loggingCommandPattern); - final Pattern pattern3 = Pattern.compile(pypiesConfigurationPattern); - - String line = StringUtils.EMPTY; - while ((line = br.readLine()) != null) { - Matcher matcher1 = pattern1.matcher(line); - Matcher matcher2 = pattern2.matcher(line); - Matcher matcher3 = pattern3.matcher(line); - - if (matcher1.matches()) { - line = matcher1.group(GROUP_INDEX_ONE); - line += httpdPypiesDirectory; - } else if (matcher2.matches()) { - line = matcher2.group(GROUP_INDEX_ONE); - line += this.configuration.getTestCaseName(); - line += matcher2.group(GROUP_INDEX_TWO); - } else if (matcher3.matches()) { - line = matcher3.group(GROUP_INDEX_ONE) + pypiesDirectory - + File.separator + "conf" + File.separator - + "pypies.cfg"; - } - - bw.write(line + "\n"); - } - - br.close(); - bw.close(); - } - - /* - * The following functions and usage of the following functions would no - * longer be necessary with Apache Commons IOUtils. - */ - private BufferedReader getBufferedReader(String file) - throws FileNotFoundException { - return new BufferedReader(new FileReader(this.getFile(file))); - } - - private BufferedWriter getBufferedWriter(String file) throws IOException { - return new BufferedWriter(new FileWriter(this.getFile(file))); - } - - private File getFile(String file) { - return new File(file); - } + public Wes2BridgeManager() { + } + + /** + * @param args + */ + public static void main(String[] args) { + if (args.length != 1) { + System.out + .println("ERROR: The configuration file has not been specified."); + System.exit(EXIT_FAILURE); + } + + Wes2BridgeManager manager = new Wes2BridgeManager(); + try { + manager.init(args[0]); + } catch (Exception e1) { + e1.printStackTrace(); + System.exit(EXIT_FAILURE); + } + + try { + manager.reconfigureEdex(); + } catch (Exception e1) { + e1.printStackTrace(); + System.exit(EXIT_FAILURE); + } + + try { + manager.reconfigurePostgreSQL(); + } catch (Exception e1) { + e1.printStackTrace(); + System.exit(EXIT_FAILURE); + } + + try { + manager.reconfigureQPID(); + } catch (Exception e1) { + e1.printStackTrace(); + System.exit(EXIT_FAILURE); + } + + try { + manager.reconfigurePypies(); + } catch (Exception e1) { + e1.printStackTrace(); + System.exit(EXIT_FAILURE); + } + + System.exit(EXIT_SUCCESS); + } + + public void init(String arg1) throws ConfigurationException { + configuration = new Wes2BridgeConfiguration(arg1); + configuration.init(); + this.wes2BridgeScripts = WES2BRIDGE_DIRECTORY + "/" + + configuration.getTestCaseName() + "/" + "edex-environment"; + } + + /* + * Updates setup.env and wrapper.conf. + */ + public void reconfigureEdex() throws FileNotFoundException, IOException { + final String srcEdexDirectory = AWIPSII + "/" + "edex"; + final String edexDirectory = WES2BRIDGE_DIRECTORY + "/" + + this.configuration.getTestCaseName() + "/" + "edex"; + + this.updateEdexSetup(srcEdexDirectory, edexDirectory); + this.updateEdexWrapper(srcEdexDirectory, edexDirectory); + this.updateEdexCamel(edexDirectory); + } + + private void updateEdexSetup(String srcEdexDirectory, String edexDirectory) + throws FileNotFoundException, IOException, IllegalStateException { + String srcsetup_env = srcEdexDirectory + "/bin/setup.env"; + String setup_env = edexDirectory + "/bin/setup.env"; + + BufferedReader br = null; + BufferedWriter bw = null; + + try { + br = this.getBufferedReader(srcsetup_env); + bw = this.getBufferedWriter(setup_env); + + final String line1 = "export DATA_ARCHIVE_ROOT="; + final String line2 = "export DB_PORT="; + final String line3 = "export BROKER_ADDR="; + final String line4 = "export HTTP_PORT="; + final String line5 = "export JMS_SERVER="; + final String line6 = "export SHARE_DIR="; + final String pypiesServerPattern = "(export PYPIES_SERVER=http://.+:)[1-9][0-9]+"; + final Pattern pattern7 = Pattern.compile(pypiesServerPattern); + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + Matcher matcher = pattern7.matcher(line); + + if (line.startsWith(line1)) { + line = line1 + this.configuration.getDataArchiveRoot(); + } else if (line.startsWith(line2)) { + line = line2 + this.configuration.getDatabasePort(); + } else if (line.startsWith(line3)) { + line = line3 + "localhost:" + + this.configuration.getJmsPort(); + } else if (line.startsWith(line4)) { + line = line4 + this.configuration.getEdexHttpPort(); + } else if (line.startsWith(line5)) { + line = line5 + "tcp://localhost:" + + this.configuration.getJmsPort(); + } else if (line.startsWith(line6)) { + line = line6 + edexDirectory + "/data/share"; + } else if (matcher.matches()) { + line = matcher.group(GROUP_INDEX_ONE) + + this.configuration.getHttpdPypiesPort(); + } + + bw.write(line + "\n"); + } + } finally { + br.close(); + bw.close(); + } + } + + /* Disable JMX. */ + private void updateEdexWrapper(String srcEdexDirectory, String edexDirectory) + throws FileNotFoundException, IOException { + String srcwrapper_conf = srcEdexDirectory + "/conf/wrapper.conf"; + String wrapper_conf = edexDirectory + "/conf/wrapper.conf"; + + BufferedReader br = null; + 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 + * wes2bridge.instance argument. + */ + boolean wes2BridgeInstanceAdded = false; + + /* + * Disable JMX Remote and add a new wes2bridge.instance JVM argument + * so that it will be possible to determine which edex instance + * belongs to which test case. + */ + /* + * This may apply to multiple jvm arguments including: 1) + * -Dcom.sun.management.jmxremote.port 2) + * -Dcom.sun.management.jmxremote.authenticate 3) + * -Dcom.sun.management.jmxremote.ssl + */ + final String line1 = "-Dcom.sun.management.jmxremote"; + /* Set the web port; used by uengine spring. */ + final String line2 = "-Dweb.port"; + /* Set the confidential port; used by uengine spring. */ + final String line3 = "-Dconfidential.port"; + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + if (line.contains(line1)) { + line = this.getJVMArgumentName(line); + if (wes2BridgeInstanceAdded == false) { + line += "-Dwes2bridge.instance=" + + this.configuration.getTestCaseName(); + wes2BridgeInstanceAdded = true; + } + } else if (line.contains(line2)) { + line = this.getJVMArgumentName(line); + line += line2 + "=" + this.configuration.getWebPort(); + } else if (line.contains(line3)) { + line = this.getJVMArgumentName(line); + line += line3 + "=" + + this.configuration.getConfidentialPort(); + } + + bw.write(line + "\n"); + } + } finally { + br.close(); + bw.close(); + } + } + + private String getJVMArgumentName(String jvmArgument) { + if (jvmArgument == null) { + System.out.println("ERROR: Invalid wrapper.conf file."); + System.exit(EXIT_FAILURE); + } + + String[] splitJVMArg = jvmArgument.split("="); + if (splitJVMArg.length <= 0) { + System.out.println("ERROR: Invalid wrapper.conf file."); + System.exit(EXIT_FAILURE); + } + + return splitJVMArg[0] + "="; + } + + private void updateEdexCamel(String edexDirectory) + throws FileNotFoundException, IOException { + final String srcedex_camel = AWIPSII_WES2BRIDGE_SCRIPTS + "/" + + "edex_camel"; + final String edex_camel = this.wes2BridgeScripts + "/edex_camel"; + + BufferedReader br = null; + BufferedWriter bw = null; + try { + br = this.getBufferedReader(srcedex_camel); + bw = this.getBufferedWriter(edex_camel); + + final String line1 = "EDEX_INSTALL="; + final String line2 = "export DATA_ARCHIVE_ROOT="; + final String line3 = "CAMELPROCESS=`ps -ef | grep \"aw.site.identifier\"|grep -c \"edex.run.mode=${1} \" `"; + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + if (line.trim().startsWith(line1)) { + line = line1 + edexDirectory; + } else if (line.trim().startsWith(line2)) { + line = line2 + this.configuration.getDataArchiveRoot(); + } else if (line.trim().startsWith(line3)) { + line = "CAMELPROCESS=`ps -ef | " + + "grep \"wes2bridge.instance=" + + this.configuration.getTestCaseName() + "\" | " + + "grep -c \"edex.run.mode=${1} \" `"; + } + + bw.write(line + "\n"); + } + } finally { + br.close(); + bw.close(); + } + } + + public void reconfigurePostgreSQL() throws FileNotFoundException, + IOException { + final String postgresqlRootDirectory = WES2BRIDGE_DIRECTORY + + File.separator + this.configuration.getTestCaseName(); + final String srcDataDirectory = AWIPSII + File.separator + "data"; + + this.updateEdexPostgres(postgresqlRootDirectory); + this.updatePostgresqlConf(srcDataDirectory); + } + + private void updateEdexPostgres(String postgresqlRootDirectory) + throws FileNotFoundException, IOException { + final String srcedex_postgres = AWIPSII_WES2BRIDGE_SCRIPTS + "/" + + "edex_postgres"; + final String edex_postgres = this.wes2BridgeScripts + "/edex_postgres"; + + BufferedReader br = null; + BufferedWriter bw = null; + try { + br = this.getBufferedReader(srcedex_postgres); + bw = this.getBufferedWriter(edex_postgres); + + final String line1 = "POSTGRESQL_INSTALL_ROOT="; + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + if (line.startsWith(line1)) { + line = line1 + postgresqlRootDirectory; + } + + bw.write(line + "\n"); + } + } finally { + br.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, + ParserConfigurationException, SAXException, + TransformerFactoryConfigurationError, TransformerException { + final String srcQpidDirectory = AWIPSII + "/" + "qpid"; + final String qpidDirectory = WES2BRIDGE_DIRECTORY + "/" + + this.configuration.getTestCaseName() + "/" + "qpid"; + + this.updateQpidConfigXML(srcQpidDirectory, qpidDirectory); + this.updateQPIDD(qpidDirectory); + } + + /* Updates qpid config.xml */ + private void updateQpidConfigXML(String srcQpidDirectory, + String qpidDirectory) throws FileNotFoundException, IOException, + ParserConfigurationException, SAXException, + TransformerFactoryConfigurationError, TransformerException { + String srcconfig_xml = srcQpidDirectory + "/etc/config.xml"; + String config_xml = qpidDirectory + "/etc/config.xml"; + + DocumentBuilder documentBuilder = DocumentBuilderFactory.newInstance() + .newDocumentBuilder(); + Document document = documentBuilder.parse(srcconfig_xml); + + // Get the root broker node. + Node brokerNode = document.getElementsByTagName( + IQpidConfigurationXML.XML_BROKER).item(0); + // Get the connector node. + Node connectorNode = this.getChildNodeByName(brokerNode, + IQpidConfigurationXML.XML_CONNECTOR); + // Get the management node. + Node managementNode = this.getChildNodeByName(brokerNode, + IQpidConfigurationXML.XML_MANAGEMENT); + // Get the jmxport node. + Node jmxPortNode = this.getChildNodeByName(managementNode, + IQpidConfigurationXML.XML_JMXPORT); + // Get the http port node. + Node httpPortNode = this.getChildNodeByName(managementNode, + IQpidConfigurationXML.XML_HTTP); + + Node portNode = null; + + // Get the connector port node. + portNode = this.getChildNodeByName(connectorNode, + IQpidConfigurationXML.XML_PORT); + portNode.setTextContent(Integer.toString(this.configuration + .getJmsPort())); + // Get the jmxport registryServer node + portNode = this.getChildNodeByName(jmxPortNode, + IQpidConfigurationXML.XML_REGISTRY_SERVER); + portNode.setTextContent(Integer.toString(this.configuration + .getQpidJmxPort())); + // Get the http port node. + portNode = this.getChildNodeByName(httpPortNode, + IQpidConfigurationXML.XML_PORT); + portNode.setTextContent(Integer.toString(this.configuration + .getQpidHttpPort())); + + /* + * Write the updated configuration file to its destination. + */ + Transformer transformer = TransformerFactory.newInstance() + .newTransformer(); + DOMSource domSource = new DOMSource(document); + StreamResult streamResult = new StreamResult(new File(config_xml)); + transformer.transform(domSource, streamResult); + } + + private Node getChildNodeByName(Node parentNode, String childName) { + if (parentNode.hasChildNodes() == false) { + return null; + } + + NodeList nodeList = parentNode.getChildNodes(); + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + if (node.getNodeName().equals(childName)) { + return node; + } + } + + return null; + } + + private void updateQPIDD(String qpidDirectory) + throws FileNotFoundException, IOException { + final String srcqpidd = AWIPSII_WES2BRIDGE_SCRIPTS + "/" + "qpidd"; + final String qpidd = this.wes2BridgeScripts + "/qpidd"; + + BufferedReader br = null; + BufferedWriter bw = null; + try { + br = this.getBufferedReader(srcqpidd); + bw = this.getBufferedWriter(qpidd); + + final String line1 = "QPID_HOME="; + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + if (line.startsWith(line1)) { + line = line1 + qpidDirectory; + } + + bw.write(line + "\n"); + } + } finally { + br.close(); + bw.close(); + } + } + + /* + * This method will: 1) update pypies.cfg 2) update httpd.conf + */ + public void reconfigurePypies() throws FileNotFoundException, IOException { + final String srcPypiesDirectory = AWIPSII + File.separator + "pypies"; + final String pypiesDirectory = WES2BRIDGE_DIRECTORY + File.separator + + this.configuration.getTestCaseName() + File.separator + + "pypies"; + + final String srcHttpdPypiesDirectory = AWIPSII + File.separator + + "httpd_pypies"; + final String httpdPypiesDirectory = WES2BRIDGE_DIRECTORY + + File.separator + this.configuration.getTestCaseName() + + File.separator + "httpd_pypies"; + + this.updatePypiesCfg(srcPypiesDirectory, pypiesDirectory); + this.updateHttpdConf(srcHttpdPypiesDirectory, httpdPypiesDirectory); + this.updateHttpdPypies(httpdPypiesDirectory, pypiesDirectory); + } + + private void updatePypiesCfg(String srcPypiesDirectory, + String pypiesDirectory) throws FileNotFoundException, IOException, + IllegalArgumentException { + final String pypiesCfgPathSuffix = File.separator + "conf" + + File.separator + "pypies.cfg"; + final String srcpypiescfg = srcPypiesDirectory + pypiesCfgPathSuffix; + final String pypiescfg = pypiesDirectory + pypiesCfgPathSuffix; + + // use the default location for the hdf5 root + final String hdf5DirectoryLocation = WES2BRIDGE_DIRECTORY + + File.separator + this.configuration.getTestCaseName() + + DEFAULT_HDF5_DIRECTORY; + final String logFileDirectoryLocation = pypiesDirectory + + File.separator + "logs"; + + BufferedReader br = null; + BufferedWriter bw = null; + try { + br = this.getBufferedReader(srcpypiescfg); + bw = this.getBufferedWriter(pypiescfg); + + final String hdf5DirPattern = "(hdf5dir=).+"; + final String logFileDirPattern = "(logFileDir=).+"; + final String loggingPortPattern = "(logging_port=)[1-9][0-9]+"; + final Pattern pattern1 = Pattern.compile(hdf5DirPattern); + final Pattern pattern2 = Pattern.compile(logFileDirPattern); + final Pattern pattern3 = Pattern.compile(loggingPortPattern); + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + Matcher matcher1 = pattern1.matcher(line); + Matcher matcher2 = pattern2.matcher(line); + Matcher matcher3 = pattern3.matcher(line); + + if (matcher1.matches()) { + line = matcher1.group(GROUP_INDEX_ONE); + line += hdf5DirectoryLocation; + } else if (matcher2.matches()) { + line = matcher2.group(GROUP_INDEX_ONE); + line += logFileDirectoryLocation; + } else if (matcher3.matches()) { + line = matcher3.group(GROUP_INDEX_ONE); + line += this.configuration.getPypiesLoggingPort(); + } + + bw.write(line + "\n"); + } + } finally { + br.close(); + bw.close(); + } + } + + private void updateHttpdConf(String srcHttpdPypiesDirectory, + String httpdPypiesDirectory) throws FileNotFoundException, + IOException { + final String httpdConfPathSuffix = File.separator + "etc" + + File.separator + "httpd" + File.separator + "conf" + + File.separator + "httpd.conf"; + final String srcHttpdConf = srcHttpdPypiesDirectory + + httpdConfPathSuffix; + final String httpdConf = httpdPypiesDirectory + httpdConfPathSuffix; + final String serverRoot = httpdPypiesDirectory + File.separator + "etc" + + File.separator + "httpd"; + + BufferedReader br = null; + BufferedWriter bw = null; + try { + br = this.getBufferedReader(srcHttpdConf); + bw = this.getBufferedWriter(httpdConf); + + final String listenPattern = "(Listen )[1-9][0-9]+"; + final String serverRootPattern = "(ServerRoot \").+(\")"; + final Pattern pattern1 = Pattern.compile(listenPattern); + final Pattern pattern2 = Pattern.compile(serverRootPattern); + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + Matcher matcher1 = pattern1.matcher(line); + Matcher matcher2 = pattern2.matcher(line); + if (matcher1.matches()) { + line = matcher1.group(GROUP_INDEX_ONE); + line += this.configuration.getHttpdPypiesPort(); + } else if (matcher2.matches()) { + line = matcher2.group(GROUP_INDEX_ONE); + line += serverRoot; + line += matcher2.group(GROUP_INDEX_TWO); + } + + bw.write(line + "\n"); + } + } finally { + br.close(); + bw.close(); + } + } + + private void updateHttpdPypies(String httpdPypiesDirectory, + String pypiesDirectory) throws IOException, FileNotFoundException { + final String srchttpd_pypies = AWIPSII_WES2BRIDGE_SCRIPTS + "/" + + "httpd-pypies"; + final String httpd_pypies = this.wes2BridgeScripts + "/httpd-pypies"; + + BufferedReader br = null; + BufferedWriter bw = null; + try { + br = this.getBufferedReader(srchttpd_pypies); + bw = this.getBufferedWriter(httpd_pypies); + + final String httpdPypiesInstallPattern = "(HTTPD_PYPIES_INSTALL=).+"; + final String loggingCommandPattern = "( *nohup su awips -c \"\\$loggingCmd > /tmp/pypiesLoggingService)(.log 2>&1\" > /dev/null &)"; + final String pypiesConfigurationPattern = "(export PYPIES_CFG=).+"; + final Pattern pattern1 = Pattern.compile(httpdPypiesInstallPattern); + final Pattern pattern2 = Pattern.compile(loggingCommandPattern); + final Pattern pattern3 = Pattern + .compile(pypiesConfigurationPattern); + + String line = StringUtils.EMPTY; + while ((line = br.readLine()) != null) { + Matcher matcher1 = pattern1.matcher(line); + Matcher matcher2 = pattern2.matcher(line); + Matcher matcher3 = pattern3.matcher(line); + + if (matcher1.matches()) { + line = matcher1.group(GROUP_INDEX_ONE); + line += httpdPypiesDirectory; + } else if (matcher2.matches()) { + line = matcher2.group(GROUP_INDEX_ONE); + line += this.configuration.getTestCaseName(); + line += matcher2.group(GROUP_INDEX_TWO); + } else if (matcher3.matches()) { + line = matcher3.group(GROUP_INDEX_ONE) + pypiesDirectory + + File.separator + "conf" + File.separator + + "pypies.cfg"; + } + + bw.write(line + "\n"); + } + } finally { + br.close(); + bw.close(); + } + } + + /* + * The following functions and usage of the following functions would no + * longer be necessary with Apache Commons IOUtils. + */ + private BufferedReader getBufferedReader(String file) + throws FileNotFoundException { + return new BufferedReader(new FileReader(this.getFile(file))); + } + + private BufferedWriter getBufferedWriter(String file) throws IOException { + return new BufferedWriter(new FileWriter(this.getFile(file))); + } + + private File getFile(String file) { + return new File(file); + } } \ No newline at end of file diff --git a/javaUtilities/hydro/ohd.ihfsdb/generate.xml b/javaUtilities/hydro/ohd.ihfsdb/generate.xml index 35d0bc2d24..acbd5bdcdf 100644 --- a/javaUtilities/hydro/ohd.ihfsdb/generate.xml +++ b/javaUtilities/hydro/ohd.ihfsdb/generate.xml @@ -3,6 +3,7 @@ + @@ -12,7 +13,7 @@ - + diff --git a/rpms/awips2.core/Installer.database-server-configuration/configuration/postgresql.conf b/rpms/awips2.core/Installer.database-server-configuration/configuration/postgresql.conf index a13b4b16e6..88aaee18cf 100644 --- a/rpms/awips2.core/Installer.database-server-configuration/configuration/postgresql.conf +++ b/rpms/awips2.core/Installer.database-server-configuration/configuration/postgresql.conf @@ -60,7 +60,7 @@ listen_addresses = '*' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost'; use '*' for all # (change requires restart) -#port = 5432 # (change requires restart) +port = 5432 # (change requires restart) max_connections = 300 # (change requires restart) # Note: Increasing max_connections costs ~400 bytes of shared memory per # connection slot, plus lock space (see max_locks_per_transaction). diff --git a/rpms/awips2.core/Installer.database-standalone-configuration/configuration/postgresql.conf b/rpms/awips2.core/Installer.database-standalone-configuration/configuration/postgresql.conf index 70043e05cc..2a450abd95 100644 --- a/rpms/awips2.core/Installer.database-standalone-configuration/configuration/postgresql.conf +++ b/rpms/awips2.core/Installer.database-standalone-configuration/configuration/postgresql.conf @@ -60,7 +60,7 @@ listen_addresses = '*' # what IP address(es) to listen on; # comma-separated list of addresses; # defaults to 'localhost'; use '*' for all # (change requires restart) -#port = 5432 # (change requires restart) +port = 5432 # (change requires restart) max_connections = 300 # (change requires restart) # Note: Increasing max_connections costs ~400 bytes of shared memory per # connection slot, plus lock space (see max_locks_per_transaction). diff --git a/rpms/awips2.core/Installer.httpd-pypies/component.spec b/rpms/awips2.core/Installer.httpd-pypies/component.spec index 00d89e3dce..802f9aeec7 100644 --- a/rpms/awips2.core/Installer.httpd-pypies/component.spec +++ b/rpms/awips2.core/Installer.httpd-pypies/component.spec @@ -7,7 +7,7 @@ Summary: Pypies Apache HTTP Server Name: awips2-httpd-pypies Version: 2.2.15 -Release: 15.3.el6 +Release: 15.3-1.el6 URL: http://httpd.apache.org/ Source0: http://archive.apache.org/dist/httpd/httpd-%{version}.tar.gz Source1: index.html diff --git a/rpms/awips2.core/Installer.httpd-pypies/configuration/etc/init.d/httpd-pypies b/rpms/awips2.core/Installer.httpd-pypies/configuration/etc/init.d/httpd-pypies index 24a54b3fce..42a4a5241f 100644 --- a/rpms/awips2.core/Installer.httpd-pypies/configuration/etc/init.d/httpd-pypies +++ b/rpms/awips2.core/Installer.httpd-pypies/configuration/etc/init.d/httpd-pypies @@ -100,7 +100,9 @@ start() { stop() { 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=$? echo [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} @@ -148,7 +150,9 @@ reload() { echo $"not reloading due to configuration syntax error" failure $"not reloading $httpd due to configuration syntax error" 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=$? fi echo @@ -191,4 +195,4 @@ case "$1" in exit 1 esac -exit $RETVAL \ No newline at end of file +exit $RETVAL diff --git a/rpms/awips2.core/Installer.postgres/component.spec b/rpms/awips2.core/Installer.postgres/component.spec index e6e38e8bc0..6e5b1895ab 100644 --- a/rpms/awips2.core/Installer.postgres/component.spec +++ b/rpms/awips2.core/Installer.postgres/component.spec @@ -8,7 +8,7 @@ Name: awips2-postgresql Summary: AWIPS II PostgreSQL Distribution Version: %{_postgresql_version} -Release: 1.el6 +Release: 2.el6 Group: AWIPSII BuildRoot: %{_build_root} BuildArch: %{_build_arch} diff --git a/rpms/awips2.core/Installer.postgres/scripts/init.d/edex_postgres b/rpms/awips2.core/Installer.postgres/scripts/init.d/edex_postgres index ba446e43f7..14f99a41d3 100644 --- a/rpms/awips2.core/Installer.postgres/scripts/init.d/edex_postgres +++ b/rpms/awips2.core/Installer.postgres/scripts/init.d/edex_postgres @@ -36,8 +36,6 @@ PGDATA_DIR="${POSTGRESQL_INSTALL_ROOT}/data" PGDATA="${PGDATA_DIR}" # Who to run the postmaster as, usually "postgres". (NOT "root") PGUSER=awips -# Port to start the database with -PGPORT=5432 # Where to keep a log file PGLOG="$PGDATA/serverlog" # The path that is to be used for the script @@ -57,29 +55,29 @@ PGCTL="${POSTGRESQL_INSTALL}/bin/pg_ctl" case $1 in start) 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 RETVAL=$? ;; stop) 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 RETVAL=$? ;; restart) echo -n "Restarting EDEX PostgreSQL: " - su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w -o \"-p $PGPORT\"" - su $PGUSER -c "$DAEMON -D '$PGDATA' -p $PGPORT &" >>$PGLOG 2>&1 + su $PGUSER -c "$PGCTL stop -D '$PGDATA' -s -m fast -w" + su $PGUSER -c "$DAEMON -D '$PGDATA' &" >>$PGLOG 2>&1 RETVAL=$? ;; reload) 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=$? ;; status) - su $PGUSER -c "$PGCTL status -D '$PGDATA' -o \"-p $PGPORT\"" + su $PGUSER -c "$PGCTL status -D '$PGDATA'" ;; *) # Print help diff --git a/rpms/awips2.core/Installer.postgres/scripts/start_developer_postgres.sh b/rpms/awips2.core/Installer.postgres/scripts/start_developer_postgres.sh index 80d248d05e..76fc1475e3 100644 --- a/rpms/awips2.core/Installer.postgres/scripts/start_developer_postgres.sh +++ b/rpms/awips2.core/Installer.postgres/scripts/start_developer_postgres.sh @@ -11,9 +11,6 @@ prefix="${POSTGRESQL_INSTALL}/postgresql" # Data Directory PGDATA="${POSTGRESQL_INSTALL}/data" -# Port to start the database with -PGPORT=5432 - # Where to keep a log file PGLOG="$PGDATA/serverlog" @@ -40,7 +37,7 @@ set -e test -x $DAEMON || exit 0 echo -n "Starting PostgreSQL: " -$DAEMON -D $PGDATA -p $PGPORT +$DAEMON -D $PGDATA diff --git a/rpms/awips2.core/Installer.postgres/scripts/start_postgres.sh b/rpms/awips2.core/Installer.postgres/scripts/start_postgres.sh index 955cd1f2c7..f92e729f35 100644 --- a/rpms/awips2.core/Installer.postgres/scripts/start_postgres.sh +++ b/rpms/awips2.core/Installer.postgres/scripts/start_postgres.sh @@ -11,9 +11,6 @@ prefix="${POSTGRESQL_INSTALL}/postgresql" # Data Directory PGDATA="${POSTGRESQL_INSTALL}/data" -# Port to start the database with -PGPORT=5432 - # Where to keep a log file PGLOG="$PGDATA/serverlog" @@ -40,7 +37,7 @@ set -e test -x $DAEMON || exit 0 echo -n "Starting PostgreSQL: " -$DAEMON -D $PGDATA -p $PGPORT +$DAEMON -D $PGDATA