Uploaded image for project: 'JBoss Web Server'
  1. JBoss Web Server
  2. JWS-537

Controlling Apache using custom script from JBoss ON UI

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Can't Do
    • Icon: Major Major
    • None
    • None
    • JON plugin
    • None

      An attempt to run service script or custom script from JBoss ON UI to control Apache (by setting "Control script path") fails. According to the code in the rhq/source/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerOperationsDelegate.java, everything is hardcoded and parameters -d, -f and -k are always added which is the reason why the actual command run by the agent looks like:

      ... -d /etc/httpd -f /etc/httpd/conf/httpd.conf -k restart

      So, the only way to work around this is to use a wrapper script that will ignore all arguments except the last one (-k) and then run the script with sudo while passing the last argument (start, stop,...) to it.

      Version-Release number of selected component (if applicable):
      Apache 2.4

      How reproducible:
      Always

      Steps to Reproduce:
      1.
      2.
      3.

      Actual results:
      Apache instance cannot be controlled using custom script as additional parameters are added by default.

      Expected results:
      Apache instance is properly controlled using custom script.

      Additional info:

      To workaround this create a wrapper script that strips all the arguments except the last one and set it as the "Control Script Path" for the Apache resource (on the Connection Settings page).

      For example, the following script will check for the "-k" parameter and send its value (start, stop,...) to the service httpd command:

      ***********************************************
      #!/bin/bash

      while [ "$1" != "-k" ] && [ ! $# -eq 1 ]; do
      shift
      done

      if [ $# -lt 2 ]; then
      echo "Parameter -k not found?" >&2
      exit 2
      fi

            rhn-engineering-jclere Jean-Frederic Clere
            rhn-support-bkramer1 Biljana Kramer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: