You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stratos.apache.org by Lahiru Sandaruwan <la...@wso2.com> on 2014/01/15 08:32:29 UTC

Re: [1/4] git commit: Updated stratos.sh (source: wso2server.sh from WSO2 Carbon 4.2.0)

Hi Isuru,

Seems following line is removed from loadbalancer startup script. This
cause errors while starting...


-Dloadbalancer.conf.file="$CARBON_HOME/repository/conf/loadbalancer.conf" \


On Mon, Jan 13, 2014 at 9:28 AM, <is...@apache.org> wrote:

> Updated Branches:
>   refs/heads/master f8605c956 -> 8adffee23
>
>
> Updated stratos.sh (source: wso2server.sh from WSO2 Carbon 4.2.0)
>
>
> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/6cb59f64
> Tree:
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/6cb59f64
> Diff:
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/6cb59f64
>
> Branch: refs/heads/master
> Commit: 6cb59f64b8103b7efc91e8c0cb58b347f9b9991a
> Parents: b3420b3
> Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
> Authored: Thu Jan 9 15:08:32 2014 +0530
> Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
> Committed: Thu Jan 9 15:09:34 2014 +0530
>
> ----------------------------------------------------------------------
>  .../distribution/src/main/resources/stratos.sh  | 122 ++++++++-------
>  .../distribution/src/main/resources/stratos.sh  | 123 ++++++++-------
>  .../distribution/src/main/bin/stratos.sh        | 151 ++++++++++---------
>  .../modules/distribution/src/bin/stratos.sh     |  41 ++---
>  .../stratos-installer/config/cc/bin/stratos.sh  | 121 ++++++++-------
>  5 files changed, 295 insertions(+), 263 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
> ----------------------------------------------------------------------
> diff --git
> a/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
> b/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
> index 0232137..77f7a91 100644
> ---
> a/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
> +++
> b/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
> @@ -1,27 +1,29 @@
>  #!/bin/sh
>  #
> ----------------------------------------------------------------------------
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements.  See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership.  The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License.  You may obtain a copy of the License at
> +#  Licensed to the Apache Software Foundation (ASF) under one
> +#  or more contributor license agreements.  See the NOTICE file
> +#  distributed with this work for additional information
> +#  regarding copyright ownership.  The ASF licenses this file
> +#  to you under the Apache License, Version 2.0 (the
> +#  "License"); you may not use this file except in compliance
> +#  with the License.  You may obtain a copy of the License at
>  #
> -#     http://www.apache.org/licenses/LICENSE-2.0
> +#      http://www.apache.org/licenses/LICENSE-2.0
>  #
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied.  See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -
> +#  Unless required by applicable law or agreed to in writing,
> +#  software distributed under the License is distributed on an
> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +#  KIND, either express or implied.  See the License for the
> +#  specific language governing permissions and limitations
> +#  under the License.
>  #
> ----------------------------------------------------------------------------
> -# Main Script for the Apache Stratos
> +# Main Script for the Apache Stratos (incubating)
>  #
>  # Environment Variable Prerequisites
>  #
> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will  try
> +#                   to figure it out.
> +#
>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>  #
>  #   JAVA_OPTS       (Optional) Java runtime options used when the commands
> @@ -31,6 +33,7 @@
>  #
> -----------------------------------------------------------------------------
>
>  # OS specific support.  $var _must_ be set to either true or false.
> +#ulimit -n 100000
>
>  cygwin=false;
>  darwin=false;
> @@ -130,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>    exit 1
>  fi
>
> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
> +fi
> +
>  # ----- Process the input command
> ----------------------------------------------
> +args=""
>  for c in $*
>  do
>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ];
> then
> @@ -140,29 +148,18 @@ do
>            if [ -z "$PORT" ]; then
>                  PORT=$c
>            fi
> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
> -          CMD="--n"
> -          continue
> -    elif [ "$CMD" = "--n" ]; then
> -          if [ -z "$INSTANCES" ]; then
> -                INSTANCES=$c
> -          fi
>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
> then
>            CMD="stop"
>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
> ]; then
>            CMD="start"
> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
> "console" ]; then
> -          CMD="console"
>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
> "version" ]; then
>            CMD="version"
>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
> "restart" ]; then
>            CMD="restart"
> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
> then
> -          CMD="dump"
>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
> then
>            CMD="test"
> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
> "status" ]; then
> -          CMD="status"
> +    else
> +        args="$args $c"
>      fi
>  done
>
> @@ -177,23 +174,35 @@ if [ "$CMD" = "--debug" ]; then
>    CMD="RUN"
>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>    echo "Please start the remote debugging client to continue..."
> -elif [ "$CMD" = "--n" ]; then
> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed 's/[0-9]//g'`
> ]]; then
> -    echo " Please specify the number of instances to start after the --n
> option"
> -    exit 1
> -  fi
>  elif [ "$CMD" = "start" ]; then
> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +    if  ps -p $PID >&- ; then
> +      echo "Process is already running"
> +      exit 0
> +    fi
> +  fi
>    export CARBON_HOME=$CARBON_HOME
> -  nohup $CARBON_HOME/bin/stratos.sh &
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "stop" ]; then
>    export CARBON_HOME=$CARBON_HOME
> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>    exit 0
>  elif [ "$CMD" = "restart" ]; then
>    export CARBON_HOME=$CARBON_HOME
> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
> -  nohup $CARBON_HOME/bin/stratos.sh &
> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
> +  process_status=0
> +  pid=`cat $CARBON_HOME/wso2carbon.pid`
> +  while [ "$process_status" -eq "0" ]
> +  do
> +        sleep 1;
> +        ps -p$pid 2>&1 > /dev/null
> +        process_status=$?
> +  done
> +
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "test" ]; then
>      JAVACMD="exec "$JAVACMD""
> @@ -230,7 +239,10 @@ do
>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>      fi
>  done
> -
> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
> +do
> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
> +done
>  # For Cygwin, switch paths to Windows format before running java
>  if $cygwin; then
>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
> @@ -252,25 +264,18 @@ cd "$CARBON_HOME"
>  START_EXIT_STATUS=121
>  status=$START_EXIT_STATUS
>
> +#To monitor a Carbon server in remote JMX mode on linux host machines,
> set the below system property.
> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
> +
>  while [ "$status" = "$START_EXIT_STATUS" ]
>  do
>      $JAVACMD \
> -     -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> -     -d64 \
> -     -server \
> -     -Xms1500m -Xmx3000m \
> -     -XX:PermSize=256m -XX:MaxPermSize=512m \
> -     -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit \
> -     -XX:+CMSClassUnloadingEnabled \
> -     -XX:+OptimizeStringConcat \
> -     -XX:+HeapDumpOnOutOfMemoryError \
> -     -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
> -     -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
> -     -XX:ErrorFile=repository/logs/hs_err_pid.log \
> -     -XX:OnError="nohup ./stratos.sh &" \
> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
> +    -server \
> +    -XX:+HeapDumpOnOutOfMemoryError \
> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>      $JAVA_OPTS \
> -    -DandesConfig=qpid-config.xml \
> -    -Ddisable.cassandra.server.startup=true \
>      -Dcom.sun.management.jmxremote \
>      -classpath "$CARBON_CLASSPATH" \
>      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
> @@ -280,17 +285,20 @@ do
>      -Dcarbon.registry.root=/ \
>      -Djava.command="$JAVACMD" \
>      -Dcarbon.home="$CARBON_HOME" \
> -
>  -Dwso2.transports.xml="$CARBON_HOME/repository/conf/mgt-transports.xml" \
> -
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
> \
> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
> +
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
> \
>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
> +    -Dconf.location="$CARBON_HOME/repository/conf"\
>      -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties"
> \
>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
>      -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
>      -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
> +    -Djava.security.egd=file:/dev/./urandom \
> +    -Dfile.encoding=UTF8 \
> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>      org.wso2.carbon.bootstrap.Bootstrap $*
>      status=$?
>  done
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
> ----------------------------------------------------------------------
> diff --git
> a/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
> b/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
> index 2a5176e..77f7a91 100644
> ---
> a/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
> +++
> b/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
> @@ -1,27 +1,29 @@
>  #!/bin/sh
>  #
> ----------------------------------------------------------------------------
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements.  See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership.  The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License.  You may obtain a copy of the License at
> +#  Licensed to the Apache Software Foundation (ASF) under one
> +#  or more contributor license agreements.  See the NOTICE file
> +#  distributed with this work for additional information
> +#  regarding copyright ownership.  The ASF licenses this file
> +#  to you under the Apache License, Version 2.0 (the
> +#  "License"); you may not use this file except in compliance
> +#  with the License.  You may obtain a copy of the License at
>  #
> -#     http://www.apache.org/licenses/LICENSE-2.0
> +#      http://www.apache.org/licenses/LICENSE-2.0
>  #
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied.  See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -
> +#  Unless required by applicable law or agreed to in writing,
> +#  software distributed under the License is distributed on an
> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +#  KIND, either express or implied.  See the License for the
> +#  specific language governing permissions and limitations
> +#  under the License.
>  #
> ----------------------------------------------------------------------------
> -# Main Script for the Apache Stratos
> +# Main Script for the Apache Stratos (incubating)
>  #
>  # Environment Variable Prerequisites
>  #
> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will  try
> +#                   to figure it out.
> +#
>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>  #
>  #   JAVA_OPTS       (Optional) Java runtime options used when the commands
> @@ -31,6 +33,7 @@
>  #
> -----------------------------------------------------------------------------
>
>  # OS specific support.  $var _must_ be set to either true or false.
> +#ulimit -n 100000
>
>  cygwin=false;
>  darwin=false;
> @@ -130,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>    exit 1
>  fi
>
> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
> +fi
> +
>  # ----- Process the input command
> ----------------------------------------------
> +args=""
>  for c in $*
>  do
>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ];
> then
> @@ -140,29 +148,18 @@ do
>            if [ -z "$PORT" ]; then
>                  PORT=$c
>            fi
> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
> -          CMD="--n"
> -          continue
> -    elif [ "$CMD" = "--n" ]; then
> -          if [ -z "$INSTANCES" ]; then
> -                INSTANCES=$c
> -          fi
>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
> then
>            CMD="stop"
>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
> ]; then
>            CMD="start"
> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
> "console" ]; then
> -          CMD="console"
>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
> "version" ]; then
>            CMD="version"
>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
> "restart" ]; then
>            CMD="restart"
> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
> then
> -          CMD="dump"
>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
> then
>            CMD="test"
> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
> "status" ]; then
> -          CMD="status"
> +    else
> +        args="$args $c"
>      fi
>  done
>
> @@ -177,23 +174,35 @@ if [ "$CMD" = "--debug" ]; then
>    CMD="RUN"
>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>    echo "Please start the remote debugging client to continue..."
> -elif [ "$CMD" = "--n" ]; then
> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed 's/[0-9]//g'`
> ]]; then
> -    echo " Please specify the number of instances to start after the --n
> option"
> -    exit 1
> -  fi
>  elif [ "$CMD" = "start" ]; then
> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +    if  ps -p $PID >&- ; then
> +      echo "Process is already running"
> +      exit 0
> +    fi
> +  fi
>    export CARBON_HOME=$CARBON_HOME
> -  nohup $CARBON_HOME/bin/stratos.sh &
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "stop" ]; then
>    export CARBON_HOME=$CARBON_HOME
> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>    exit 0
>  elif [ "$CMD" = "restart" ]; then
>    export CARBON_HOME=$CARBON_HOME
> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
> -  nohup $CARBON_HOME/bin/stratos.sh &
> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
> +  process_status=0
> +  pid=`cat $CARBON_HOME/wso2carbon.pid`
> +  while [ "$process_status" -eq "0" ]
> +  do
> +        sleep 1;
> +        ps -p$pid 2>&1 > /dev/null
> +        process_status=$?
> +  done
> +
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "test" ]; then
>      JAVACMD="exec "$JAVACMD""
> @@ -230,7 +239,10 @@ do
>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>      fi
>  done
> -
> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
> +do
> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
> +done
>  # For Cygwin, switch paths to Windows format before running java
>  if $cygwin; then
>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
> @@ -252,25 +264,18 @@ cd "$CARBON_HOME"
>  START_EXIT_STATUS=121
>  status=$START_EXIT_STATUS
>
> +#To monitor a Carbon server in remote JMX mode on linux host machines,
> set the below system property.
> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
> +
>  while [ "$status" = "$START_EXIT_STATUS" ]
>  do
>      $JAVACMD \
> -     -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> -     -d64 \
> -     -server \
> -     -Xms1500m -Xmx3000m \
> -     -XX:PermSize=256m -XX:MaxPermSize=512m \
> -     -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit \
> -     -XX:+CMSClassUnloadingEnabled \
> -     -XX:+OptimizeStringConcat \
> -     -XX:+HeapDumpOnOutOfMemoryError \
> -     -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
> -     -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
> -     -XX:ErrorFile=repository/logs/hs_err_pid.log \
> -     -XX:OnError="nohup ./stratos.sh &" \
> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
> +    -server \
> +    -XX:+HeapDumpOnOutOfMemoryError \
> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>      $JAVA_OPTS \
> -    -DandesConfig=qpid-config.xml \
> -    -Ddisable.cassandra.server.startup=true \
>      -Dcom.sun.management.jmxremote \
>      -classpath "$CARBON_CLASSPATH" \
>      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
> @@ -280,18 +285,20 @@ do
>      -Dcarbon.registry.root=/ \
>      -Djava.command="$JAVACMD" \
>      -Dcarbon.home="$CARBON_HOME" \
> -
>  -Dwso2.transports.xml="$CARBON_HOME/repository/conf/mgt-transports.xml" \
> -
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
> \
> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
> +
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
> \
>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
> +    -Dconf.location="$CARBON_HOME/repository/conf"\
>      -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties"
> \
>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>      -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
>      -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
> +    -Djava.security.egd=file:/dev/./urandom \
> +    -Dfile.encoding=UTF8 \
> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>      org.wso2.carbon.bootstrap.Bootstrap $*
>      status=$?
>  done
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
> ----------------------------------------------------------------------
> diff --git
> a/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
> b/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
> index 7d8f2f1..77f7a91 100644
> --- a/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
> +++ b/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
> @@ -17,19 +17,23 @@
>  #  specific language governing permissions and limitations
>  #  under the License.
>  #
> ----------------------------------------------------------------------------
> -#  Main Script for the Apache Stratos
> +# Main Script for the Apache Stratos (incubating)
>  #
> -#  Environment Variable Prerequisites
> +# Environment Variable Prerequisites
> +#
> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will  try
> +#                   to figure it out.
>  #
>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>  #
>  #   JAVA_OPTS       (Optional) Java runtime options used when the commands
>  #                   is executed.
>  #
> -#  NOTE: Borrowed generously from Apache Tomcat startup scripts.
> +# NOTE: Borrowed generously from Apache Tomcat startup scripts.
>  #
> -----------------------------------------------------------------------------
>
>  # OS specific support.  $var _must_ be set to either true or false.
> +#ulimit -n 100000
>
>  cygwin=false;
>  darwin=false;
> @@ -129,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>    exit 1
>  fi
>
> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
> +fi
> +
>  # ----- Process the input command
> ----------------------------------------------
> +args=""
>  for c in $*
>  do
>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ];
> then
> @@ -139,29 +148,18 @@ do
>            if [ -z "$PORT" ]; then
>                  PORT=$c
>            fi
> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
> -          CMD="--n"
> -          continue
> -    elif [ "$CMD" = "--n" ]; then
> -          if [ -z "$INSTANCES" ]; then
> -                INSTANCES=$c
> -          fi
>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
> then
>            CMD="stop"
>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
> ]; then
>            CMD="start"
> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
> "console" ]; then
> -          CMD="console"
>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
> "version" ]; then
>            CMD="version"
>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
> "restart" ]; then
>            CMD="restart"
> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
> then
> -          CMD="dump"
>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
> then
>            CMD="test"
> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
> "status" ]; then
> -          CMD="status"
> +    else
> +        args="$args $c"
>      fi
>  done
>
> @@ -176,18 +174,20 @@ if [ "$CMD" = "--debug" ]; then
>    CMD="RUN"
>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>    echo "Please start the remote debugging client to continue..."
> -elif [ "$CMD" = "--n" ]; then
> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed 's/[0-9]//g'`
> ]]; then
> -    echo " Please specify the number of instances to start after the --n
> option"
> -    exit 1
> -  fi
>  elif [ "$CMD" = "start" ]; then
> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +    if  ps -p $PID >&- ; then
> +      echo "Process is already running"
> +      exit 0
> +    fi
> +  fi
>    export CARBON_HOME=$CARBON_HOME
> -  nohup $CARBON_HOME/bin/stratos.sh &
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "stop" ]; then
>    export CARBON_HOME=$CARBON_HOME
> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>    exit 0
>  elif [ "$CMD" = "restart" ]; then
>    export CARBON_HOME=$CARBON_HOME
> @@ -196,13 +196,13 @@ elif [ "$CMD" = "restart" ]; then
>    pid=`cat $CARBON_HOME/wso2carbon.pid`
>    while [ "$process_status" -eq "0" ]
>    do
> -    sleep 1;
> -    ps -p$pid 2>&1 > /dev/null
> -    process_status=$?
> +        sleep 1;
> +        ps -p$pid 2>&1 > /dev/null
> +        process_status=$?
>    done
>
> -  # using nohup bash to avoid erros in solaris OS.TODO
> -  nohup bash $CARBON_HOME/bin/stratos.sh > /dev/null 2>&1 &
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "test" ]; then
>      JAVACMD="exec "$JAVACMD""
> @@ -212,18 +212,11 @@ elif [ "$CMD" = "version" ]; then
>    exit 0
>  fi
>
> +# ---------- Handle the SSL Issue with proper JDK version
> --------------------
>  jdk_16=`$JAVA_HOME/bin/java -version 2>&1 | grep "1.[6|7]"`
> -
>  if [ "$jdk_16" = "" ]; then
> +   echo " Starting WSO2 Carbon (in unsupported JDK)"
>     echo " [ERROR] CARBON is supported only on JDK 1.6 and 1.7"
> -   exit 1
> -fi
> -
> -CARBON_CLASSPATH=""
> -if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
> -   if [ "$f" != "$JAVA_HOME/lib/tools.jar" ];then
> -        CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
> -   fi
>  fi
>
>  CARBON_XBOOTCLASSPATH=""
> @@ -236,13 +229,20 @@ done
>
>
>  JAVA_ENDORSED_DIRS="$CARBON_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed"
>
> +CARBON_CLASSPATH=""
> +if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
> +    CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
> +fi
>  for f in "$CARBON_HOME"/bin/*.jar
>  do
>      if [ "$f" != "$CARBON_HOME/bin/*.jar" ];then
>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>      fi
>  done
> -
> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
> +do
> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
> +done
>  # For Cygwin, switch paths to Windows format before running java
>  if $cygwin; then
>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
> @@ -261,41 +261,44 @@ echo CARBON_HOME environment variable is set to
> $CARBON_HOME
>
>  cd "$CARBON_HOME"
>
> -exec "$JAVACMD" \
> -        -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> -        -d64 \
> -        -server \
> -        -Xms1500m -Xmx3000m \
> -        -XX:PermSize=256m -XX:MaxPermSize=512m \
> -        -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit \
> -        -XX:+CMSClassUnloadingEnabled \
> -        -XX:+OptimizeStringConcat \
> -        -XX:+HeapDumpOnOutOfMemoryError \
> -        -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
> -        -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
> -        -XX:ErrorFile=repository/logs/hs_err_pid.log \
> -        -XX:OnError="nohup ./stratos.sh &" \
> -        $JAVA_OPTS \
> -        -Dcarbon.pid=$$ \
> -        -Dcom.sun.management.jmxremote \
> -        -Dwso2.loadbalancer=true \
> -        -classpath "$CARBON_CLASSPATH" \
> -        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
> -        -Djava.io.tmpdir="$CARBON_HOME/tmp" \
> -        -Dwso2.server.standalone=true \
> -        -Dcarbon.registry.root=/ \
> -        -Dcarbon.home="$CARBON_HOME" \
> -
>  -Dloadbalancer.conf.file="$CARBON_HOME/repository/conf/loadbalancer.conf" \
> -
>  -Djava.util.logging.config.file="$CARBON_HOME/lib/log4j.properties" \
> -        -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
> -        -Dconf.location="$CARBON_HOME/repository/conf" \
> -        -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
> -        -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
> -
>  -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
> -        -Dcom.atomikos.icatch.hide_init_file_path=true \
> -        -Dorg.terracotta.quartz.skipUpdateCheck=true \
> -
>  -Djavax.net.ssl.trustStore=$CARBON_HOME/repository/resources/security/client-truststore.jks
> \
> -        -Djavax.net.ssl.trustStorePassword=wso2carbon \
> -        org.wso2.carbon.bootstrap.Bootstrap $*
> +START_EXIT_STATUS=121
> +status=$START_EXIT_STATUS
>
> +#To monitor a Carbon server in remote JMX mode on linux host machines,
> set the below system property.
> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
>
> +while [ "$status" = "$START_EXIT_STATUS" ]
> +do
> +    $JAVACMD \
> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
> +    -server \
> +    -XX:+HeapDumpOnOutOfMemoryError \
> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
> +    $JAVA_OPTS \
> +    -Dcom.sun.management.jmxremote \
> +    -classpath "$CARBON_CLASSPATH" \
> +    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
> +    -Djava.io.tmpdir="$CARBON_HOME/tmp" \
> +    -Dcatalina.base="$CARBON_HOME/lib/tomcat" \
> +    -Dwso2.server.standalone=true \
> +    -Dcarbon.registry.root=/ \
> +    -Djava.command="$JAVACMD" \
> +    -Dcarbon.home="$CARBON_HOME" \
> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
> +    -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
> +
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
> \
> +    -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
> +    -Dconf.location="$CARBON_HOME/repository/conf"\
> +    -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties"
> \
> +    -Dcom.atomikos.icatch.hide_init_file_path=true \
> +    -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
> +    -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
> +    -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
> +    -Dorg.terracotta.quartz.skipUpdateCheck=true \
> +    -Djava.security.egd=file:/dev/./urandom \
> +    -Dfile.encoding=UTF8 \
> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
> +    org.wso2.carbon.bootstrap.Bootstrap $*
> +    status=$?
> +done
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/stratos-manager/modules/distribution/src/bin/stratos.sh
> ----------------------------------------------------------------------
> diff --git
> a/products/stratos-manager/modules/distribution/src/bin/stratos.sh
> b/products/stratos-manager/modules/distribution/src/bin/stratos.sh
> index 7cb00b5..77f7a91 100755
> --- a/products/stratos-manager/modules/distribution/src/bin/stratos.sh
> +++ b/products/stratos-manager/modules/distribution/src/bin/stratos.sh
> @@ -1,23 +1,25 @@
>  #!/bin/sh
>  #
> ----------------------------------------------------------------------------
> -#  Copyright 2005-2012 WSO2, Inc. http://www.wso2.org
> -#
> -#  Licensed under the Apache License, Version 2.0 (the "License");
> -#  you may not use this file except in compliance with the License.
> -#  You may obtain a copy of the License at
> +#  Licensed to the Apache Software Foundation (ASF) under one
> +#  or more contributor license agreements.  See the NOTICE file
> +#  distributed with this work for additional information
> +#  regarding copyright ownership.  The ASF licenses this file
> +#  to you under the Apache License, Version 2.0 (the
> +#  "License"); you may not use this file except in compliance
> +#  with the License.  You may obtain a copy of the License at
>  #
>  #      http://www.apache.org/licenses/LICENSE-2.0
>  #
> -#  Unless required by applicable law or agreed to in writing, software
> -#  distributed under the License is distributed on an "AS IS" BASIS,
> -#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> implied.
> -#  See the License for the specific language governing permissions and
> -#  limitations under the License.
> -
> +#  Unless required by applicable law or agreed to in writing,
> +#  software distributed under the License is distributed on an
> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +#  KIND, either express or implied.  See the License for the
> +#  specific language governing permissions and limitations
> +#  under the License.
>  #
> ----------------------------------------------------------------------------
> -# Main Script for the WSO2 Carbon Server
> +# Main Script for the Apache Stratos (incubating)
>  #
> -# Environment Variable Prequisites
> +# Environment Variable Prerequisites
>  #
>  #   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will  try
>  #                   to figure it out.
> @@ -136,6 +138,7 @@ if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>  fi
>
>  # ----- Process the input command
> ----------------------------------------------
> +args=""
>  for c in $*
>  do
>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ];
> then
> @@ -155,6 +158,8 @@ do
>            CMD="restart"
>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
> then
>            CMD="test"
> +    else
> +        args="$args $c"
>      fi
>  done
>
> @@ -178,7 +183,7 @@ elif [ "$CMD" = "start" ]; then
>    fi
>    export CARBON_HOME=$CARBON_HOME
>  # using nohup bash to avoid erros in solaris OS.TODO
> -  nohup bash $CARBON_HOME/bin/stratos.sh > /dev/null 2>&1 &
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "stop" ]; then
>    export CARBON_HOME=$CARBON_HOME
> @@ -197,7 +202,7 @@ elif [ "$CMD" = "restart" ]; then
>    done
>
>  # using nohup bash to avoid erros in solaris OS.TODO
> -  nohup bash $CARBON_HOME/bin/stratos.sh > /dev/null 2>&1 &
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "test" ]; then
>      JAVACMD="exec "$JAVACMD""
> @@ -267,6 +272,7 @@ do
>      $JAVACMD \
>      -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>      -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
> +    -server \
>      -XX:+HeapDumpOnOutOfMemoryError \
>      -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>      $JAVA_OPTS \
> @@ -279,12 +285,11 @@ do
>      -Dcarbon.registry.root=/ \
>      -Djava.command="$JAVACMD" \
>      -Dcarbon.home="$CARBON_HOME" \
> -
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
> \
>      -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
> +
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
> \
>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
>      -Dconf.location="$CARBON_HOME/repository/conf"\
> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>      -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties"
> \
>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
> @@ -293,7 +298,7 @@ do
>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
>      -Djava.security.egd=file:/dev/./urandom \
>      -Dfile.encoding=UTF8 \
> -    -Dloadbalancer.conf=file:repository/conf/loadbalancer.conf \
> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>      org.wso2.carbon.bootstrap.Bootstrap $*
>      status=$?
>  done
>
>
> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/tools/stratos-installer/config/cc/bin/stratos.sh
> ----------------------------------------------------------------------
> diff --git a/tools/stratos-installer/config/cc/bin/stratos.sh
> b/tools/stratos-installer/config/cc/bin/stratos.sh
> index c9a5812..77f7a91 100644
> --- a/tools/stratos-installer/config/cc/bin/stratos.sh
> +++ b/tools/stratos-installer/config/cc/bin/stratos.sh
> @@ -1,27 +1,29 @@
>  #!/bin/sh
>  #
> ----------------------------------------------------------------------------
> -# Licensed to the Apache Software Foundation (ASF) under one
> -# or more contributor license agreements.  See the NOTICE file
> -# distributed with this work for additional information
> -# regarding copyright ownership.  The ASF licenses this file
> -# to you under the Apache License, Version 2.0 (the
> -# "License"); you may not use this file except in compliance
> -# with the License.  You may obtain a copy of the License at
> +#  Licensed to the Apache Software Foundation (ASF) under one
> +#  or more contributor license agreements.  See the NOTICE file
> +#  distributed with this work for additional information
> +#  regarding copyright ownership.  The ASF licenses this file
> +#  to you under the Apache License, Version 2.0 (the
> +#  "License"); you may not use this file except in compliance
> +#  with the License.  You may obtain a copy of the License at
>  #
> -#     http://www.apache.org/licenses/LICENSE-2.0
> +#      http://www.apache.org/licenses/LICENSE-2.0
>  #
> -# Unless required by applicable law or agreed to in writing,
> -# software distributed under the License is distributed on an
> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> -# KIND, either express or implied.  See the License for the
> -# specific language governing permissions and limitations
> -# under the License.
> -
> +#  Unless required by applicable law or agreed to in writing,
> +#  software distributed under the License is distributed on an
> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
> +#  KIND, either express or implied.  See the License for the
> +#  specific language governing permissions and limitations
> +#  under the License.
>  #
> ----------------------------------------------------------------------------
> -# Main Script for the Apache Stratos
> +# Main Script for the Apache Stratos (incubating)
>  #
>  # Environment Variable Prerequisites
>  #
> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will  try
> +#                   to figure it out.
> +#
>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>  #
>  #   JAVA_OPTS       (Optional) Java runtime options used when the commands
> @@ -31,6 +33,7 @@
>  #
> -----------------------------------------------------------------------------
>
>  # OS specific support.  $var _must_ be set to either true or false.
> +#ulimit -n 100000
>
>  cygwin=false;
>  darwin=false;
> @@ -130,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>    exit 1
>  fi
>
> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
> +fi
> +
>  # ----- Process the input command
> ----------------------------------------------
> +args=""
>  for c in $*
>  do
>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug" ];
> then
> @@ -140,29 +148,18 @@ do
>            if [ -z "$PORT" ]; then
>                  PORT=$c
>            fi
> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
> -          CMD="--n"
> -          continue
> -    elif [ "$CMD" = "--n" ]; then
> -          if [ -z "$INSTANCES" ]; then
> -                INSTANCES=$c
> -          fi
>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
> then
>            CMD="stop"
>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
> ]; then
>            CMD="start"
> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
> "console" ]; then
> -          CMD="console"
>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
> "version" ]; then
>            CMD="version"
>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
> "restart" ]; then
>            CMD="restart"
> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
> then
> -          CMD="dump"
>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
> then
>            CMD="test"
> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
> "status" ]; then
> -          CMD="status"
> +    else
> +        args="$args $c"
>      fi
>  done
>
> @@ -177,23 +174,35 @@ if [ "$CMD" = "--debug" ]; then
>    CMD="RUN"
>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>    echo "Please start the remote debugging client to continue..."
> -elif [ "$CMD" = "--n" ]; then
> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed 's/[0-9]//g'`
> ]]; then
> -    echo " Please specify the number of instances to start after the --n
> option"
> -    exit 1
> -  fi
>  elif [ "$CMD" = "start" ]; then
> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
> +    if  ps -p $PID >&- ; then
> +      echo "Process is already running"
> +      exit 0
> +    fi
> +  fi
>    export CARBON_HOME=$CARBON_HOME
> -  nohup $CARBON_HOME/bin/stratos.sh &
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "stop" ]; then
>    export CARBON_HOME=$CARBON_HOME
> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>    exit 0
>  elif [ "$CMD" = "restart" ]; then
>    export CARBON_HOME=$CARBON_HOME
> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
> -  nohup $CARBON_HOME/bin/stratos.sh &
> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
> +  process_status=0
> +  pid=`cat $CARBON_HOME/wso2carbon.pid`
> +  while [ "$process_status" -eq "0" ]
> +  do
> +        sleep 1;
> +        ps -p$pid 2>&1 > /dev/null
> +        process_status=$?
> +  done
> +
> +# using nohup bash to avoid erros in solaris OS.TODO
> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>    exit 0
>  elif [ "$CMD" = "test" ]; then
>      JAVACMD="exec "$JAVACMD""
> @@ -230,7 +239,10 @@ do
>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>      fi
>  done
> -
> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
> +do
> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
> +done
>  # For Cygwin, switch paths to Windows format before running java
>  if $cygwin; then
>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
> @@ -252,25 +264,18 @@ cd "$CARBON_HOME"
>  START_EXIT_STATUS=121
>  status=$START_EXIT_STATUS
>
> +#To monitor a Carbon server in remote JMX mode on linux host machines,
> set the below system property.
> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
> +
>  while [ "$status" = "$START_EXIT_STATUS" ]
>  do
>      $JAVACMD \
> -     -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> -     -d64 \
> -     -server \
> -     -Xms1500m -Xmx3000m \
> -     -XX:PermSize=256m -XX:MaxPermSize=512m \
> -     -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit \
> -     -XX:+CMSClassUnloadingEnabled \
> -     -XX:+OptimizeStringConcat \
> -     -XX:+HeapDumpOnOutOfMemoryError \
> -     -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
> -     -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
> -     -XX:ErrorFile=repository/logs/hs_err_pid.log \
> -     -XX:OnError="nohup ./stratos.sh &" \
> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
> +    -server \
> +    -XX:+HeapDumpOnOutOfMemoryError \
> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>      $JAVA_OPTS \
> -    -DandesConfig=qpid-config.xml \
> -    -Ddisable.cassandra.server.startup=true \
>      -Dcom.sun.management.jmxremote \
>      -classpath "$CARBON_CLASSPATH" \
>      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
> @@ -280,16 +285,20 @@ do
>      -Dcarbon.registry.root=/ \
>      -Djava.command="$JAVACMD" \
>      -Dcarbon.home="$CARBON_HOME" \
> -
>  -Dwso2.transports.xml="$CARBON_HOME/repository/conf/mgt-transports.xml" \
> -
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
> \
> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
> +
>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
> \
>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
> +    -Dconf.location="$CARBON_HOME/repository/conf"\
>      -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties"
> \
>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
>      -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
>      -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
> +    -Djava.security.egd=file:/dev/./urandom \
> +    -Dfile.encoding=UTF8 \
> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>      org.wso2.carbon.bootstrap.Bootstrap $*
>      status=$?
>  done
>
>


-- 
--
Lahiru Sandaruwan
Software Engineer,
Platform Technologies,
WSO2 Inc., http://wso2.com
lean.enterprise.middleware

email: lahirus@wso2.com cell: (+94) 773 325 954
blog: http://lahiruwrites.blogspot.com/
twitter: http://twitter.com/lahirus
linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146

Re: [1/4] git commit: Updated stratos.sh (source: wso2server.sh from WSO2 Carbon 4.2.0)

Posted by Isuru Perera <is...@wso2.com>.
Hi Lahiru,

Sorry, I updated this stratos.sh as discussed earlier in dev@ [1].

It's good that you added it back! :)

Thanks!

Best Regards,

[1]
http://mail-archives.apache.org/mod_mbox/stratos-dev/201401.mbox/%3CCADQ5vQSVy%3DAnjR1W%2BA7UrZ5JX8q9acsru3DSVGR%3D-bLbXX7ODg%40mail.gmail.com%3E


On Wed, Jan 15, 2014 at 1:02 PM, Lahiru Sandaruwan <la...@wso2.com> wrote:

> Hi Isuru,
>
> Seems following line is removed from loadbalancer startup script. This
> cause errors while starting...
>
>
> -Dloadbalancer.conf.file="$CARBON_HOME/repository/conf/loadbalancer.conf" \
>
>
> On Mon, Jan 13, 2014 at 9:28 AM, <is...@apache.org> wrote:
>
>> Updated Branches:
>>   refs/heads/master f8605c956 -> 8adffee23
>>
>>
>> Updated stratos.sh (source: wso2server.sh from WSO2 Carbon 4.2.0)
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/incubator-stratos/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/commit/6cb59f64
>> Tree:
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/tree/6cb59f64
>> Diff:
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/diff/6cb59f64
>>
>> Branch: refs/heads/master
>> Commit: 6cb59f64b8103b7efc91e8c0cb58b347f9b9991a
>> Parents: b3420b3
>> Author: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>> Authored: Thu Jan 9 15:08:32 2014 +0530
>> Committer: M. Isuru Tharanga Chrishantha Perera <is...@apache.org>
>> Committed: Thu Jan 9 15:09:34 2014 +0530
>>
>> ----------------------------------------------------------------------
>>  .../distribution/src/main/resources/stratos.sh  | 122 ++++++++-------
>>  .../distribution/src/main/resources/stratos.sh  | 123 ++++++++-------
>>  .../distribution/src/main/bin/stratos.sh        | 151 ++++++++++---------
>>  .../modules/distribution/src/bin/stratos.sh     |  41 ++---
>>  .../stratos-installer/config/cc/bin/stratos.sh  | 121 ++++++++-------
>>  5 files changed, 295 insertions(+), 263 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
>> ----------------------------------------------------------------------
>> diff --git
>> a/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
>> b/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
>> index 0232137..77f7a91 100644
>> ---
>> a/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
>> +++
>> b/products/autoscaler/modules/distribution/src/main/resources/stratos.sh
>> @@ -1,27 +1,29 @@
>>  #!/bin/sh
>>  #
>> ----------------------------------------------------------------------------
>> -# Licensed to the Apache Software Foundation (ASF) under one
>> -# or more contributor license agreements.  See the NOTICE file
>> -# distributed with this work for additional information
>> -# regarding copyright ownership.  The ASF licenses this file
>> -# to you under the Apache License, Version 2.0 (the
>> -# "License"); you may not use this file except in compliance
>> -# with the License.  You may obtain a copy of the License at
>> +#  Licensed to the Apache Software Foundation (ASF) under one
>> +#  or more contributor license agreements.  See the NOTICE file
>> +#  distributed with this work for additional information
>> +#  regarding copyright ownership.  The ASF licenses this file
>> +#  to you under the Apache License, Version 2.0 (the
>> +#  "License"); you may not use this file except in compliance
>> +#  with the License.  You may obtain a copy of the License at
>>  #
>> -#     http://www.apache.org/licenses/LICENSE-2.0
>> +#      http://www.apache.org/licenses/LICENSE-2.0
>>  #
>> -# Unless required by applicable law or agreed to in writing,
>> -# software distributed under the License is distributed on an
>> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> -# KIND, either express or implied.  See the License for the
>> -# specific language governing permissions and limitations
>> -# under the License.
>> -
>> +#  Unless required by applicable law or agreed to in writing,
>> +#  software distributed under the License is distributed on an
>> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> +#  KIND, either express or implied.  See the License for the
>> +#  specific language governing permissions and limitations
>> +#  under the License.
>>  #
>> ----------------------------------------------------------------------------
>> -# Main Script for the Apache Stratos
>> +# Main Script for the Apache Stratos (incubating)
>>  #
>>  # Environment Variable Prerequisites
>>  #
>> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will
>>  try
>> +#                   to figure it out.
>> +#
>>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>>  #
>>  #   JAVA_OPTS       (Optional) Java runtime options used when the
>> commands
>> @@ -31,6 +33,7 @@
>>  #
>> -----------------------------------------------------------------------------
>>
>>  # OS specific support.  $var _must_ be set to either true or false.
>> +#ulimit -n 100000
>>
>>  cygwin=false;
>>  darwin=false;
>> @@ -130,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>>    exit 1
>>  fi
>>
>> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
>> +fi
>> +
>>  # ----- Process the input command
>> ----------------------------------------------
>> +args=""
>>  for c in $*
>>  do
>>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug"
>> ]; then
>> @@ -140,29 +148,18 @@ do
>>            if [ -z "$PORT" ]; then
>>                  PORT=$c
>>            fi
>> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
>> -          CMD="--n"
>> -          continue
>> -    elif [ "$CMD" = "--n" ]; then
>> -          if [ -z "$INSTANCES" ]; then
>> -                INSTANCES=$c
>> -          fi
>>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
>> then
>>            CMD="stop"
>>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
>> ]; then
>>            CMD="start"
>> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
>> "console" ]; then
>> -          CMD="console"
>>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
>> "version" ]; then
>>            CMD="version"
>>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
>> "restart" ]; then
>>            CMD="restart"
>> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
>> then
>> -          CMD="dump"
>>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
>> then
>>            CMD="test"
>> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
>> "status" ]; then
>> -          CMD="status"
>> +    else
>> +        args="$args $c"
>>      fi
>>  done
>>
>> @@ -177,23 +174,35 @@ if [ "$CMD" = "--debug" ]; then
>>    CMD="RUN"
>>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>>    echo "Please start the remote debugging client to continue..."
>> -elif [ "$CMD" = "--n" ]; then
>> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed
>> 's/[0-9]//g'` ]]; then
>> -    echo " Please specify the number of instances to start after the --n
>> option"
>> -    exit 1
>> -  fi
>>  elif [ "$CMD" = "start" ]; then
>> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +    if  ps -p $PID >&- ; then
>> +      echo "Process is already running"
>> +      exit 0
>> +    fi
>> +  fi
>>    export CARBON_HOME=$CARBON_HOME
>> -  nohup $CARBON_HOME/bin/stratos.sh &
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "stop" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
>> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>>    exit 0
>>  elif [ "$CMD" = "restart" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
>> -  nohup $CARBON_HOME/bin/stratos.sh &
>> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>> +  process_status=0
>> +  pid=`cat $CARBON_HOME/wso2carbon.pid`
>> +  while [ "$process_status" -eq "0" ]
>> +  do
>> +        sleep 1;
>> +        ps -p$pid 2>&1 > /dev/null
>> +        process_status=$?
>> +  done
>> +
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "test" ]; then
>>      JAVACMD="exec "$JAVACMD""
>> @@ -230,7 +239,10 @@ do
>>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>>      fi
>>  done
>> -
>> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
>> +do
>> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
>> +done
>>  # For Cygwin, switch paths to Windows format before running java
>>  if $cygwin; then
>>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
>> @@ -252,25 +264,18 @@ cd "$CARBON_HOME"
>>  START_EXIT_STATUS=121
>>  status=$START_EXIT_STATUS
>>
>> +#To monitor a Carbon server in remote JMX mode on linux host machines,
>> set the below system property.
>> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
>> +
>>  while [ "$status" = "$START_EXIT_STATUS" ]
>>  do
>>      $JAVACMD \
>> -     -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> -     -d64 \
>> -     -server \
>> -     -Xms1500m -Xmx3000m \
>> -     -XX:PermSize=256m -XX:MaxPermSize=512m \
>> -     -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit \
>> -     -XX:+CMSClassUnloadingEnabled \
>> -     -XX:+OptimizeStringConcat \
>> -     -XX:+HeapDumpOnOutOfMemoryError \
>> -     -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
>> -     -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
>> -     -XX:ErrorFile=repository/logs/hs_err_pid.log \
>> -     -XX:OnError="nohup ./stratos.sh &" \
>> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
>> +    -server \
>> +    -XX:+HeapDumpOnOutOfMemoryError \
>> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>>      $JAVA_OPTS \
>> -    -DandesConfig=qpid-config.xml \
>> -    -Ddisable.cassandra.server.startup=true \
>>      -Dcom.sun.management.jmxremote \
>>      -classpath "$CARBON_CLASSPATH" \
>>      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
>> @@ -280,17 +285,20 @@ do
>>      -Dcarbon.registry.root=/ \
>>      -Djava.command="$JAVACMD" \
>>      -Dcarbon.home="$CARBON_HOME" \
>> -
>>  -Dwso2.transports.xml="$CARBON_HOME/repository/conf/mgt-transports.xml" \
>> -
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
>> \
>> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
>> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>> +
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
>> \
>>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
>> +    -Dconf.location="$CARBON_HOME/repository/conf"\
>>
>>  -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
>>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
>>      -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
>>      -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
>>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
>> +    -Djava.security.egd=file:/dev/./urandom \
>> +    -Dfile.encoding=UTF8 \
>> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>>      org.wso2.carbon.bootstrap.Bootstrap $*
>>      status=$?
>>  done
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
>> ----------------------------------------------------------------------
>> diff --git
>> a/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
>> b/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
>> index 2a5176e..77f7a91 100644
>> ---
>> a/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
>> +++
>> b/products/cloud-controller/modules/distribution/src/main/resources/stratos.sh
>> @@ -1,27 +1,29 @@
>>  #!/bin/sh
>>  #
>> ----------------------------------------------------------------------------
>> -# Licensed to the Apache Software Foundation (ASF) under one
>> -# or more contributor license agreements.  See the NOTICE file
>> -# distributed with this work for additional information
>> -# regarding copyright ownership.  The ASF licenses this file
>> -# to you under the Apache License, Version 2.0 (the
>> -# "License"); you may not use this file except in compliance
>> -# with the License.  You may obtain a copy of the License at
>> +#  Licensed to the Apache Software Foundation (ASF) under one
>> +#  or more contributor license agreements.  See the NOTICE file
>> +#  distributed with this work for additional information
>> +#  regarding copyright ownership.  The ASF licenses this file
>> +#  to you under the Apache License, Version 2.0 (the
>> +#  "License"); you may not use this file except in compliance
>> +#  with the License.  You may obtain a copy of the License at
>>  #
>> -#     http://www.apache.org/licenses/LICENSE-2.0
>> +#      http://www.apache.org/licenses/LICENSE-2.0
>>  #
>> -# Unless required by applicable law or agreed to in writing,
>> -# software distributed under the License is distributed on an
>> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> -# KIND, either express or implied.  See the License for the
>> -# specific language governing permissions and limitations
>> -# under the License.
>> -
>> +#  Unless required by applicable law or agreed to in writing,
>> +#  software distributed under the License is distributed on an
>> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> +#  KIND, either express or implied.  See the License for the
>> +#  specific language governing permissions and limitations
>> +#  under the License.
>>  #
>> ----------------------------------------------------------------------------
>> -# Main Script for the Apache Stratos
>> +# Main Script for the Apache Stratos (incubating)
>>  #
>>  # Environment Variable Prerequisites
>>  #
>> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will
>>  try
>> +#                   to figure it out.
>> +#
>>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>>  #
>>  #   JAVA_OPTS       (Optional) Java runtime options used when the
>> commands
>> @@ -31,6 +33,7 @@
>>  #
>> -----------------------------------------------------------------------------
>>
>>  # OS specific support.  $var _must_ be set to either true or false.
>> +#ulimit -n 100000
>>
>>  cygwin=false;
>>  darwin=false;
>> @@ -130,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>>    exit 1
>>  fi
>>
>> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
>> +fi
>> +
>>  # ----- Process the input command
>> ----------------------------------------------
>> +args=""
>>  for c in $*
>>  do
>>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug"
>> ]; then
>> @@ -140,29 +148,18 @@ do
>>            if [ -z "$PORT" ]; then
>>                  PORT=$c
>>            fi
>> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
>> -          CMD="--n"
>> -          continue
>> -    elif [ "$CMD" = "--n" ]; then
>> -          if [ -z "$INSTANCES" ]; then
>> -                INSTANCES=$c
>> -          fi
>>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
>> then
>>            CMD="stop"
>>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
>> ]; then
>>            CMD="start"
>> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
>> "console" ]; then
>> -          CMD="console"
>>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
>> "version" ]; then
>>            CMD="version"
>>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
>> "restart" ]; then
>>            CMD="restart"
>> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
>> then
>> -          CMD="dump"
>>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
>> then
>>            CMD="test"
>> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
>> "status" ]; then
>> -          CMD="status"
>> +    else
>> +        args="$args $c"
>>      fi
>>  done
>>
>> @@ -177,23 +174,35 @@ if [ "$CMD" = "--debug" ]; then
>>    CMD="RUN"
>>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>>    echo "Please start the remote debugging client to continue..."
>> -elif [ "$CMD" = "--n" ]; then
>> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed
>> 's/[0-9]//g'` ]]; then
>> -    echo " Please specify the number of instances to start after the --n
>> option"
>> -    exit 1
>> -  fi
>>  elif [ "$CMD" = "start" ]; then
>> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +    if  ps -p $PID >&- ; then
>> +      echo "Process is already running"
>> +      exit 0
>> +    fi
>> +  fi
>>    export CARBON_HOME=$CARBON_HOME
>> -  nohup $CARBON_HOME/bin/stratos.sh &
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "stop" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
>> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>>    exit 0
>>  elif [ "$CMD" = "restart" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
>> -  nohup $CARBON_HOME/bin/stratos.sh &
>> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>> +  process_status=0
>> +  pid=`cat $CARBON_HOME/wso2carbon.pid`
>> +  while [ "$process_status" -eq "0" ]
>> +  do
>> +        sleep 1;
>> +        ps -p$pid 2>&1 > /dev/null
>> +        process_status=$?
>> +  done
>> +
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "test" ]; then
>>      JAVACMD="exec "$JAVACMD""
>> @@ -230,7 +239,10 @@ do
>>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>>      fi
>>  done
>> -
>> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
>> +do
>> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
>> +done
>>  # For Cygwin, switch paths to Windows format before running java
>>  if $cygwin; then
>>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
>> @@ -252,25 +264,18 @@ cd "$CARBON_HOME"
>>  START_EXIT_STATUS=121
>>  status=$START_EXIT_STATUS
>>
>> +#To monitor a Carbon server in remote JMX mode on linux host machines,
>> set the below system property.
>> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
>> +
>>  while [ "$status" = "$START_EXIT_STATUS" ]
>>  do
>>      $JAVACMD \
>> -     -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> -     -d64 \
>> -     -server \
>> -     -Xms1500m -Xmx3000m \
>> -     -XX:PermSize=256m -XX:MaxPermSize=512m \
>> -     -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit \
>> -     -XX:+CMSClassUnloadingEnabled \
>> -     -XX:+OptimizeStringConcat \
>> -     -XX:+HeapDumpOnOutOfMemoryError \
>> -     -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
>> -     -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
>> -     -XX:ErrorFile=repository/logs/hs_err_pid.log \
>> -     -XX:OnError="nohup ./stratos.sh &" \
>> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
>> +    -server \
>> +    -XX:+HeapDumpOnOutOfMemoryError \
>> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>>      $JAVA_OPTS \
>> -    -DandesConfig=qpid-config.xml \
>> -    -Ddisable.cassandra.server.startup=true \
>>      -Dcom.sun.management.jmxremote \
>>      -classpath "$CARBON_CLASSPATH" \
>>      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
>> @@ -280,18 +285,20 @@ do
>>      -Dcarbon.registry.root=/ \
>>      -Djava.command="$JAVACMD" \
>>      -Dcarbon.home="$CARBON_HOME" \
>> -
>>  -Dwso2.transports.xml="$CARBON_HOME/repository/conf/mgt-transports.xml" \
>> -
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
>> \
>> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
>> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>> +
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
>> \
>>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
>> +    -Dconf.location="$CARBON_HOME/repository/conf"\
>>
>>  -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
>>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
>> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>>      -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
>>      -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
>>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
>> +    -Djava.security.egd=file:/dev/./urandom \
>> +    -Dfile.encoding=UTF8 \
>> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>>      org.wso2.carbon.bootstrap.Bootstrap $*
>>      status=$?
>>  done
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
>> ----------------------------------------------------------------------
>> diff --git
>> a/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
>> b/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
>> index 7d8f2f1..77f7a91 100644
>> --- a/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
>> +++ b/products/load-balancer/modules/distribution/src/main/bin/stratos.sh
>> @@ -17,19 +17,23 @@
>>  #  specific language governing permissions and limitations
>>  #  under the License.
>>  #
>> ----------------------------------------------------------------------------
>> -#  Main Script for the Apache Stratos
>> +# Main Script for the Apache Stratos (incubating)
>>  #
>> -#  Environment Variable Prerequisites
>> +# Environment Variable Prerequisites
>> +#
>> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will
>>  try
>> +#                   to figure it out.
>>  #
>>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>>  #
>>  #   JAVA_OPTS       (Optional) Java runtime options used when the
>> commands
>>  #                   is executed.
>>  #
>> -#  NOTE: Borrowed generously from Apache Tomcat startup scripts.
>> +# NOTE: Borrowed generously from Apache Tomcat startup scripts.
>>  #
>> -----------------------------------------------------------------------------
>>
>>  # OS specific support.  $var _must_ be set to either true or false.
>> +#ulimit -n 100000
>>
>>  cygwin=false;
>>  darwin=false;
>> @@ -129,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>>    exit 1
>>  fi
>>
>> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
>> +fi
>> +
>>  # ----- Process the input command
>> ----------------------------------------------
>> +args=""
>>  for c in $*
>>  do
>>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug"
>> ]; then
>> @@ -139,29 +148,18 @@ do
>>            if [ -z "$PORT" ]; then
>>                  PORT=$c
>>            fi
>> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
>> -          CMD="--n"
>> -          continue
>> -    elif [ "$CMD" = "--n" ]; then
>> -          if [ -z "$INSTANCES" ]; then
>> -                INSTANCES=$c
>> -          fi
>>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
>> then
>>            CMD="stop"
>>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
>> ]; then
>>            CMD="start"
>> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
>> "console" ]; then
>> -          CMD="console"
>>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
>> "version" ]; then
>>            CMD="version"
>>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
>> "restart" ]; then
>>            CMD="restart"
>> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
>> then
>> -          CMD="dump"
>>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
>> then
>>            CMD="test"
>> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
>> "status" ]; then
>> -          CMD="status"
>> +    else
>> +        args="$args $c"
>>      fi
>>  done
>>
>> @@ -176,18 +174,20 @@ if [ "$CMD" = "--debug" ]; then
>>    CMD="RUN"
>>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>>    echo "Please start the remote debugging client to continue..."
>> -elif [ "$CMD" = "--n" ]; then
>> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed
>> 's/[0-9]//g'` ]]; then
>> -    echo " Please specify the number of instances to start after the --n
>> option"
>> -    exit 1
>> -  fi
>>  elif [ "$CMD" = "start" ]; then
>> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +    if  ps -p $PID >&- ; then
>> +      echo "Process is already running"
>> +      exit 0
>> +    fi
>> +  fi
>>    export CARBON_HOME=$CARBON_HOME
>> -  nohup $CARBON_HOME/bin/stratos.sh &
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "stop" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
>> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>>    exit 0
>>  elif [ "$CMD" = "restart" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> @@ -196,13 +196,13 @@ elif [ "$CMD" = "restart" ]; then
>>    pid=`cat $CARBON_HOME/wso2carbon.pid`
>>    while [ "$process_status" -eq "0" ]
>>    do
>> -    sleep 1;
>> -    ps -p$pid 2>&1 > /dev/null
>> -    process_status=$?
>> +        sleep 1;
>> +        ps -p$pid 2>&1 > /dev/null
>> +        process_status=$?
>>    done
>>
>> -  # using nohup bash to avoid erros in solaris OS.TODO
>> -  nohup bash $CARBON_HOME/bin/stratos.sh > /dev/null 2>&1 &
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "test" ]; then
>>      JAVACMD="exec "$JAVACMD""
>> @@ -212,18 +212,11 @@ elif [ "$CMD" = "version" ]; then
>>    exit 0
>>  fi
>>
>> +# ---------- Handle the SSL Issue with proper JDK version
>> --------------------
>>  jdk_16=`$JAVA_HOME/bin/java -version 2>&1 | grep "1.[6|7]"`
>> -
>>  if [ "$jdk_16" = "" ]; then
>> +   echo " Starting WSO2 Carbon (in unsupported JDK)"
>>     echo " [ERROR] CARBON is supported only on JDK 1.6 and 1.7"
>> -   exit 1
>> -fi
>> -
>> -CARBON_CLASSPATH=""
>> -if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
>> -   if [ "$f" != "$JAVA_HOME/lib/tools.jar" ];then
>> -        CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
>> -   fi
>>  fi
>>
>>  CARBON_XBOOTCLASSPATH=""
>> @@ -236,13 +229,20 @@ done
>>
>>
>>  JAVA_ENDORSED_DIRS="$CARBON_HOME/lib/endorsed":"$JAVA_HOME/jre/lib/endorsed":"$JAVA_HOME/lib/endorsed"
>>
>> +CARBON_CLASSPATH=""
>> +if [ -e "$JAVA_HOME/lib/tools.jar" ]; then
>> +    CARBON_CLASSPATH="$JAVA_HOME/lib/tools.jar"
>> +fi
>>  for f in "$CARBON_HOME"/bin/*.jar
>>  do
>>      if [ "$f" != "$CARBON_HOME/bin/*.jar" ];then
>>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>>      fi
>>  done
>> -
>> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
>> +do
>> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
>> +done
>>  # For Cygwin, switch paths to Windows format before running java
>>  if $cygwin; then
>>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
>> @@ -261,41 +261,44 @@ echo CARBON_HOME environment variable is set to
>> $CARBON_HOME
>>
>>  cd "$CARBON_HOME"
>>
>> -exec "$JAVACMD" \
>> -        -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> -        -d64 \
>> -        -server \
>> -        -Xms1500m -Xmx3000m \
>> -        -XX:PermSize=256m -XX:MaxPermSize=512m \
>> -        -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit
>> \
>> -        -XX:+CMSClassUnloadingEnabled \
>> -        -XX:+OptimizeStringConcat \
>> -        -XX:+HeapDumpOnOutOfMemoryError \
>> -        -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
>> -        -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
>> -        -XX:ErrorFile=repository/logs/hs_err_pid.log \
>> -        -XX:OnError="nohup ./stratos.sh &" \
>> -        $JAVA_OPTS \
>> -        -Dcarbon.pid=$$ \
>> -        -Dcom.sun.management.jmxremote \
>> -        -Dwso2.loadbalancer=true \
>> -        -classpath "$CARBON_CLASSPATH" \
>> -        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
>> -        -Djava.io.tmpdir="$CARBON_HOME/tmp" \
>> -        -Dwso2.server.standalone=true \
>> -        -Dcarbon.registry.root=/ \
>> -        -Dcarbon.home="$CARBON_HOME" \
>> -
>>  -Dloadbalancer.conf.file="$CARBON_HOME/repository/conf/loadbalancer.conf" \
>> -
>>  -Djava.util.logging.config.file="$CARBON_HOME/lib/log4j.properties" \
>> -        -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
>> -        -Dconf.location="$CARBON_HOME/repository/conf" \
>> -        -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>> -        -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
>> -
>>  -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
>> -        -Dcom.atomikos.icatch.hide_init_file_path=true \
>> -        -Dorg.terracotta.quartz.skipUpdateCheck=true \
>> -
>>  -Djavax.net.ssl.trustStore=$CARBON_HOME/repository/resources/security/client-truststore.jks
>> \
>> -        -Djavax.net.ssl.trustStorePassword=wso2carbon \
>> -        org.wso2.carbon.bootstrap.Bootstrap $*
>> +START_EXIT_STATUS=121
>> +status=$START_EXIT_STATUS
>>
>> +#To monitor a Carbon server in remote JMX mode on linux host machines,
>> set the below system property.
>> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
>>
>> +while [ "$status" = "$START_EXIT_STATUS" ]
>> +do
>> +    $JAVACMD \
>> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
>> +    -server \
>> +    -XX:+HeapDumpOnOutOfMemoryError \
>> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>> +    $JAVA_OPTS \
>> +    -Dcom.sun.management.jmxremote \
>> +    -classpath "$CARBON_CLASSPATH" \
>> +    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
>> +    -Djava.io.tmpdir="$CARBON_HOME/tmp" \
>> +    -Dcatalina.base="$CARBON_HOME/lib/tomcat" \
>> +    -Dwso2.server.standalone=true \
>> +    -Dcarbon.registry.root=/ \
>> +    -Djava.command="$JAVACMD" \
>> +    -Dcarbon.home="$CARBON_HOME" \
>> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>> +    -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
>> +
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
>> \
>> +    -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
>> +    -Dconf.location="$CARBON_HOME/repository/conf"\
>> +
>>  -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
>> +    -Dcom.atomikos.icatch.hide_init_file_path=true \
>> +    -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
>> +    -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
>> +    -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
>> +    -Dorg.terracotta.quartz.skipUpdateCheck=true \
>> +    -Djava.security.egd=file:/dev/./urandom \
>> +    -Dfile.encoding=UTF8 \
>> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>> +    org.wso2.carbon.bootstrap.Bootstrap $*
>> +    status=$?
>> +done
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/products/stratos-manager/modules/distribution/src/bin/stratos.sh
>> ----------------------------------------------------------------------
>> diff --git
>> a/products/stratos-manager/modules/distribution/src/bin/stratos.sh
>> b/products/stratos-manager/modules/distribution/src/bin/stratos.sh
>> index 7cb00b5..77f7a91 100755
>> --- a/products/stratos-manager/modules/distribution/src/bin/stratos.sh
>> +++ b/products/stratos-manager/modules/distribution/src/bin/stratos.sh
>> @@ -1,23 +1,25 @@
>>  #!/bin/sh
>>  #
>> ----------------------------------------------------------------------------
>> -#  Copyright 2005-2012 WSO2, Inc. http://www.wso2.org
>> -#
>> -#  Licensed under the Apache License, Version 2.0 (the "License");
>> -#  you may not use this file except in compliance with the License.
>> -#  You may obtain a copy of the License at
>> +#  Licensed to the Apache Software Foundation (ASF) under one
>> +#  or more contributor license agreements.  See the NOTICE file
>> +#  distributed with this work for additional information
>> +#  regarding copyright ownership.  The ASF licenses this file
>> +#  to you under the Apache License, Version 2.0 (the
>> +#  "License"); you may not use this file except in compliance
>> +#  with the License.  You may obtain a copy of the License at
>>  #
>>  #      http://www.apache.org/licenses/LICENSE-2.0
>>  #
>> -#  Unless required by applicable law or agreed to in writing, software
>> -#  distributed under the License is distributed on an "AS IS" BASIS,
>> -#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
>> implied.
>> -#  See the License for the specific language governing permissions and
>> -#  limitations under the License.
>> -
>> +#  Unless required by applicable law or agreed to in writing,
>> +#  software distributed under the License is distributed on an
>> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> +#  KIND, either express or implied.  See the License for the
>> +#  specific language governing permissions and limitations
>> +#  under the License.
>>  #
>> ----------------------------------------------------------------------------
>> -# Main Script for the WSO2 Carbon Server
>> +# Main Script for the Apache Stratos (incubating)
>>  #
>> -# Environment Variable Prequisites
>> +# Environment Variable Prerequisites
>>  #
>>  #   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will
>>  try
>>  #                   to figure it out.
>> @@ -136,6 +138,7 @@ if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>>  fi
>>
>>  # ----- Process the input command
>> ----------------------------------------------
>> +args=""
>>  for c in $*
>>  do
>>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug"
>> ]; then
>> @@ -155,6 +158,8 @@ do
>>            CMD="restart"
>>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
>> then
>>            CMD="test"
>> +    else
>> +        args="$args $c"
>>      fi
>>  done
>>
>> @@ -178,7 +183,7 @@ elif [ "$CMD" = "start" ]; then
>>    fi
>>    export CARBON_HOME=$CARBON_HOME
>>  # using nohup bash to avoid erros in solaris OS.TODO
>> -  nohup bash $CARBON_HOME/bin/stratos.sh > /dev/null 2>&1 &
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "stop" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> @@ -197,7 +202,7 @@ elif [ "$CMD" = "restart" ]; then
>>    done
>>
>>  # using nohup bash to avoid erros in solaris OS.TODO
>> -  nohup bash $CARBON_HOME/bin/stratos.sh > /dev/null 2>&1 &
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "test" ]; then
>>      JAVACMD="exec "$JAVACMD""
>> @@ -267,6 +272,7 @@ do
>>      $JAVACMD \
>>      -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>>      -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
>> +    -server \
>>      -XX:+HeapDumpOnOutOfMemoryError \
>>      -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>>      $JAVA_OPTS \
>> @@ -279,12 +285,11 @@ do
>>      -Dcarbon.registry.root=/ \
>>      -Djava.command="$JAVACMD" \
>>      -Dcarbon.home="$CARBON_HOME" \
>> -
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
>> \
>>      -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
>> +
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
>> \
>>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
>>      -Dconf.location="$CARBON_HOME/repository/conf"\
>> -    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>>
>>  -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
>>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
>> @@ -293,7 +298,7 @@ do
>>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
>>      -Djava.security.egd=file:/dev/./urandom \
>>      -Dfile.encoding=UTF8 \
>> -    -Dloadbalancer.conf=file:repository/conf/loadbalancer.conf \
>> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>>      org.wso2.carbon.bootstrap.Bootstrap $*
>>      status=$?
>>  done
>>
>>
>> http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/6cb59f64/tools/stratos-installer/config/cc/bin/stratos.sh
>> ----------------------------------------------------------------------
>> diff --git a/tools/stratos-installer/config/cc/bin/stratos.sh
>> b/tools/stratos-installer/config/cc/bin/stratos.sh
>> index c9a5812..77f7a91 100644
>> --- a/tools/stratos-installer/config/cc/bin/stratos.sh
>> +++ b/tools/stratos-installer/config/cc/bin/stratos.sh
>> @@ -1,27 +1,29 @@
>>  #!/bin/sh
>>  #
>> ----------------------------------------------------------------------------
>> -# Licensed to the Apache Software Foundation (ASF) under one
>> -# or more contributor license agreements.  See the NOTICE file
>> -# distributed with this work for additional information
>> -# regarding copyright ownership.  The ASF licenses this file
>> -# to you under the Apache License, Version 2.0 (the
>> -# "License"); you may not use this file except in compliance
>> -# with the License.  You may obtain a copy of the License at
>> +#  Licensed to the Apache Software Foundation (ASF) under one
>> +#  or more contributor license agreements.  See the NOTICE file
>> +#  distributed with this work for additional information
>> +#  regarding copyright ownership.  The ASF licenses this file
>> +#  to you under the Apache License, Version 2.0 (the
>> +#  "License"); you may not use this file except in compliance
>> +#  with the License.  You may obtain a copy of the License at
>>  #
>> -#     http://www.apache.org/licenses/LICENSE-2.0
>> +#      http://www.apache.org/licenses/LICENSE-2.0
>>  #
>> -# Unless required by applicable law or agreed to in writing,
>> -# software distributed under the License is distributed on an
>> -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> -# KIND, either express or implied.  See the License for the
>> -# specific language governing permissions and limitations
>> -# under the License.
>> -
>> +#  Unless required by applicable law or agreed to in writing,
>> +#  software distributed under the License is distributed on an
>> +#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
>> +#  KIND, either express or implied.  See the License for the
>> +#  specific language governing permissions and limitations
>> +#  under the License.
>>  #
>> ----------------------------------------------------------------------------
>> -# Main Script for the Apache Stratos
>> +# Main Script for the Apache Stratos (incubating)
>>  #
>>  # Environment Variable Prerequisites
>>  #
>> +#   CARBON_HOME   Home of WSO2 Carbon installation. If not set I will
>>  try
>> +#                   to figure it out.
>> +#
>>  #   JAVA_HOME       Must point at your Java Development Kit installation.
>>  #
>>  #   JAVA_OPTS       (Optional) Java runtime options used when the
>> commands
>> @@ -31,6 +33,7 @@
>>  #
>> -----------------------------------------------------------------------------
>>
>>  # OS specific support.  $var _must_ be set to either true or false.
>> +#ulimit -n 100000
>>
>>  cygwin=false;
>>  darwin=false;
>> @@ -130,7 +133,12 @@ if [ -z "$JAVA_HOME" ]; then
>>    exit 1
>>  fi
>>
>> +if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +  PID=`cat "$CARBON_HOME"/wso2carbon.pid`
>> +fi
>> +
>>  # ----- Process the input command
>> ----------------------------------------------
>> +args=""
>>  for c in $*
>>  do
>>      if [ "$c" = "--debug" ] || [ "$c" = "-debug" ] || [ "$c" = "debug"
>> ]; then
>> @@ -140,29 +148,18 @@ do
>>            if [ -z "$PORT" ]; then
>>                  PORT=$c
>>            fi
>> -    elif [ "$c" = "--n" ] || [ "$c" = "-n" ] || [ "$c" = "n" ]; then
>> -          CMD="--n"
>> -          continue
>> -    elif [ "$CMD" = "--n" ]; then
>> -          if [ -z "$INSTANCES" ]; then
>> -                INSTANCES=$c
>> -          fi
>>      elif [ "$c" = "--stop" ] || [ "$c" = "-stop" ] || [ "$c" = "stop" ];
>> then
>>            CMD="stop"
>>      elif [ "$c" = "--start" ] || [ "$c" = "-start" ] || [ "$c" = "start"
>> ]; then
>>            CMD="start"
>> -    elif [ "$c" = "--console" ] || [ "$c" = "-console" ] || [ "$c" =
>> "console" ]; then
>> -          CMD="console"
>>      elif [ "$c" = "--version" ] || [ "$c" = "-version" ] || [ "$c" =
>> "version" ]; then
>>            CMD="version"
>>      elif [ "$c" = "--restart" ] || [ "$c" = "-restart" ] || [ "$c" =
>> "restart" ]; then
>>            CMD="restart"
>> -    elif [ "$c" = "--dump" ] || [ "$c" = "-dump" ] || [ "$c" = "dump" ];
>> then
>> -          CMD="dump"
>>      elif [ "$c" = "--test" ] || [ "$c" = "-test" ] || [ "$c" = "test" ];
>> then
>>            CMD="test"
>> -    elif [ "$c" = "--status" ] || [ "$c" = "-status" ] || [ "$c" =
>> "status" ]; then
>> -          CMD="status"
>> +    else
>> +        args="$args $c"
>>      fi
>>  done
>>
>> @@ -177,23 +174,35 @@ if [ "$CMD" = "--debug" ]; then
>>    CMD="RUN"
>>    JAVA_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE
>> -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=$PORT"
>>    echo "Please start the remote debugging client to continue..."
>> -elif [ "$CMD" = "--n" ]; then
>> -  if [ "$INSTANCES" = "" ] || [ ! -z `echo $INSTANCES | sed
>> 's/[0-9]//g'` ]]; then
>> -    echo " Please specify the number of instances to start after the --n
>> option"
>> -    exit 1
>> -  fi
>>  elif [ "$CMD" = "start" ]; then
>> +  if [ -e "$CARBON_HOME/wso2carbon.pid" ]; then
>> +    if  ps -p $PID >&- ; then
>> +      echo "Process is already running"
>> +      exit 0
>> +    fi
>> +  fi
>>    export CARBON_HOME=$CARBON_HOME
>> -  nohup $CARBON_HOME/bin/stratos.sh &
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "stop" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
>> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>>    exit 0
>>  elif [ "$CMD" = "restart" ]; then
>>    export CARBON_HOME=$CARBON_HOME
>> -  kill -9 `cat $CARBON_HOME/wso2carbon.pid`
>> -  nohup $CARBON_HOME/bin/stratos.sh &
>> +  kill -term `cat $CARBON_HOME/wso2carbon.pid`
>> +  process_status=0
>> +  pid=`cat $CARBON_HOME/wso2carbon.pid`
>> +  while [ "$process_status" -eq "0" ]
>> +  do
>> +        sleep 1;
>> +        ps -p$pid 2>&1 > /dev/null
>> +        process_status=$?
>> +  done
>> +
>> +# using nohup bash to avoid erros in solaris OS.TODO
>> +  nohup bash $CARBON_HOME/bin/stratos.sh $args > /dev/null 2>&1 &
>>    exit 0
>>  elif [ "$CMD" = "test" ]; then
>>      JAVACMD="exec "$JAVACMD""
>> @@ -230,7 +239,10 @@ do
>>          CARBON_CLASSPATH="$CARBON_CLASSPATH":$f
>>      fi
>>  done
>> -
>> +for t in "$CARBON_HOME"/lib/commons-lang*.jar
>> +do
>> +    CARBON_CLASSPATH="$CARBON_CLASSPATH":$t
>> +done
>>  # For Cygwin, switch paths to Windows format before running java
>>  if $cygwin; then
>>    JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`
>> @@ -252,25 +264,18 @@ cd "$CARBON_HOME"
>>  START_EXIT_STATUS=121
>>  status=$START_EXIT_STATUS
>>
>> +#To monitor a Carbon server in remote JMX mode on linux host machines,
>> set the below system property.
>> +#   -Djava.rmi.server.hostname="your.IP.goes.here"
>> +
>>  while [ "$status" = "$START_EXIT_STATUS" ]
>>  do
>>      $JAVACMD \
>> -     -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> -     -d64 \
>> -     -server \
>> -     -Xms1500m -Xmx3000m \
>> -     -XX:PermSize=256m -XX:MaxPermSize=512m \
>> -     -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:-UseGCOverheadLimit \
>> -     -XX:+CMSClassUnloadingEnabled \
>> -     -XX:+OptimizeStringConcat \
>> -     -XX:+HeapDumpOnOutOfMemoryError \
>> -     -XX:OnOutOfMemoryError="kill -9 `echo $$`;nohup ./stratos.sh &" \
>> -     -XX:HeapDumpPath=repository/logs/heap-dump.hprof \
>> -     -XX:ErrorFile=repository/logs/hs_err_pid.log \
>> -     -XX:OnError="nohup ./stratos.sh &" \
>> +    -Xbootclasspath/a:"$CARBON_XBOOTCLASSPATH" \
>> +    -Xms256m -Xmx1024m -XX:MaxPermSize=256m \
>> +    -server \
>> +    -XX:+HeapDumpOnOutOfMemoryError \
>> +    -XX:HeapDumpPath="$CARBON_HOME/repository/logs/heap-dump.hprof" \
>>      $JAVA_OPTS \
>> -    -DandesConfig=qpid-config.xml \
>> -    -Ddisable.cassandra.server.startup=true \
>>      -Dcom.sun.management.jmxremote \
>>      -classpath "$CARBON_CLASSPATH" \
>>      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" \
>> @@ -280,16 +285,20 @@ do
>>      -Dcarbon.registry.root=/ \
>>      -Djava.command="$JAVACMD" \
>>      -Dcarbon.home="$CARBON_HOME" \
>> -
>>  -Dwso2.transports.xml="$CARBON_HOME/repository/conf/mgt-transports.xml" \
>> -
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/log4j.properties"
>> \
>> +    -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager \
>>      -Dcarbon.config.dir.path="$CARBON_HOME/repository/conf" \
>> +
>>  -Djava.util.logging.config.file="$CARBON_HOME/repository/conf/etc/logging-bridge.properties"
>> \
>>      -Dcomponents.repo="$CARBON_HOME/repository/components/plugins" \
>> +    -Dconf.location="$CARBON_HOME/repository/conf"\
>>
>>  -Dcom.atomikos.icatch.file="$CARBON_HOME/lib/transactions.properties" \
>>      -Dcom.atomikos.icatch.hide_init_file_path=true \
>>      -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true \
>>      -Dcom.sun.jndi.ldap.connect.pool.authentication=simple  \
>>      -Dcom.sun.jndi.ldap.connect.pool.timeout=3000  \
>>      -Dorg.terracotta.quartz.skipUpdateCheck=true \
>> +    -Djava.security.egd=file:/dev/./urandom \
>> +    -Dfile.encoding=UTF8 \
>> +    -Djndi.properties.dir="$CARBON_HOME/repository/conf" \
>>      org.wso2.carbon.bootstrap.Bootstrap $*
>>      status=$?
>>  done
>>
>>
>
>
> --
> --
> Lahiru Sandaruwan
> Software Engineer,
> Platform Technologies,
> WSO2 Inc., http://wso2.com
> lean.enterprise.middleware
>
> email: lahirus@wso2.com cell: (+94) 773 325 954
> blog: http://lahiruwrites.blogspot.com/
> twitter: http://twitter.com/lahirus
> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>
>


-- 
Isuru Perera
Senior Software Engineer | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

about.me/chrishantha