Configuring Team Studio to Run as a Service

Follow these steps to configure the application to start when the system boots up and control with the service command:

Perform this task on the server where Team Studio is installed.

Prerequisites

You must have write access to the server.

Procedure

  1. Create a file called chorus.server in the /etc/init.d directory and copy the following content into that file (if you need to start the application as a different user than the default chorus, change that in the content below):
    #!/bin/bash
    #set -x
    #
    # Starts a Server
    # chkconfig: 345 90 10
    # description: Chorus Server
    export CHORUS_HOME=/usr/local/chorus
    export CHORUS_USER=chorus
    export PID_PATH=/var/lock/subsys
    export PATH=$PATH:$CHORUS_HOME
    export PGPASSFILE=$CHORUS_HOME/.pgpass
    #Source Function Library
    . /etc/rc.d/init.d/functions
    RETVAL=0
    #PIDFILE="/var/lock/subsys/chorus.pid"
    PIDFILE=$PID_PATH"/chorus.pid"
    desc="Chorus Server Daemon"
    #######################################################################
    start() {
      echo -n $"Starting $desc (CSD): "
    #  source $CHORUS_HOME/chorus_path.sh /dev/null2>&1
      daemon --user=$CHORUS_USER $CHORUS_HOME/chorus_control.sh start
    #  daemon --user=$CHORUS_USER $CHORUS_HOME/chorus_control.sh main /dev/null2>&1
      RETVAL=$?
      echo
      [ $RETVAL -eq 0 ] && touch $PIDFILE
      return $RETVAL
    }
    stop() {
      echo -n $"Stopping $desc (CSD): "
    #  source $CHORUS_HOME/chorus_path.sh /dev/null2>&1
      daemon --user=$CHORUS_USER $CHORUS_HOME/chorus_control.sh stop
      RETVAL=$?
      sleep 5
      echo
      [ $RETVAL -eq 0 ] && rm -f $PIDFILE
    #  MONITOR=`ps aux | grep chorus_control | grep -v grep | awk '{print $2}'`
    #  kill -9 $MONITOR
    }
    checkstatus(){
      ps -ef | grep chorus
    }
    restart() {
      stop
      start
    }
    case "$1" in
      start)
        start
        ;;
      stop)
        stop
        ;;
      status)
        checkstatus
        ;;
      restart)
        restart
        ;;
      *)
        echo $"Usage: $0 {start|stop|status|restart}"
        exit 1
    esac
    exit $RETVAL
  2. Run this command to make the newly created script start when the system boots up:
    chkconfig --add chorus.server
  3. Now you can start and stop the processes by running the following commands. Also, the services start automatically when the system boots up.
    service chorus.server start
    service chorus.server stop