1.2.2. Running on UNIX®

The JON Server can run from a console window or run as a service started by the init process.
Setting environment variables
The rhq-server.sh file, located in the <server-install-dir>/bin/ directory, contains a detailed list of the environment variables it requires to run. For most variables, sensible defaults are used and therefore do not need editing. It is important however, to set the correct path to your Java installation. Before starting the JON Server, edit the rhq-server.sh file and ensure that either the RHQ_SERVER_JAVA_HOME or the RHQ_SERVER_JAVA_EXE_FILE_PATH variable is set appropriately.
Running in a console
To run the JON Server in a console, execute the following commands as the root user:
# cd <server-install-dir>/bin/
# ./rhq-server.sh console
Running with init.d
To ensure the JON Server is started at boot time, the rhq-server.sh script can be managed by the init process. The script must be copied to the appropriate location and the RHQ_SERVER_HOME variable must be set to the installation directory of the JON Server. The exact procedure on how to do this varies between different flavors of UNIX. The example procedure below describes this process on Red Hat Enterprise Linux 5.2.

Note

Unlike the Windows script, this UNIX script does not utilize the Java Service Wrapper utility.
Service Installation on Red Hat Enterprise Linux 5.2
The rhq-server.sh script can be placed under the /etc/init.d/ directory and managed by the service and chkconfig command. To run the JON Server as a service on Red Hat Enterprise Linux 5.2 and ensure that it starts in run level 5, follow the procedure below as the root user.

Procedure 1.1. Service Installation on Red Hat Enterprise Linux 5.2

  1. Copy the rhq-server.sh script into the /etc/init.d/ directory.
    # cp <server-install-dir>/bin/rhq-server.sh /etc/init.d/
    
  2. Edit the /etc/init.d/rhq-server.sh script and set the RHQ_SERVER_HOME variable to the JON Server install directory. For example:
    RHQ_SERVER_HOME=/opt/jon-server-2.3.0.GA/
    
  3. Edit the /etc/init.d/rhq-server.sh script and add the following lines to the top of the file, directly under #!/bin/sh. The last two parameters in the #chkconfig: 2345 95 20 line, specify the start and stop priority respectively; edit these accordingly.
    #!/bin/sh
    #chkconfig: 2345 95 20
    #description: JBoss Operations Network Server
    #processname: run.sh
    
  4. Add the service to the chkconfig service management command.
    # chkconfig --add rhq-server.sh
    # chkconfig rhq-server.sh --list
    
  5. Ensure the service will start in run level 5.
    # chkconfig --level 5 rhq-server.sh on
    
    The JON Server service can now be managed by the service rhq-server.sh { start | stop | status } command. To start the service enter the following command:
    # service rhq-server.sh start