You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by dcausevic <dz...@bstelecom.ba> on 2010/07/01 08:34:13 UTC

Re: Startup script for Axis2

Here it is... I had to develep it myself. Anyway here it is if anyone else
might need it. It's for debian, but I am sure it would work with RedHat and
other distributions as well with minor changes in code.

#!/bin/sh

# Written by Dzenan Causevic <dz...@bstelecom.ba>

# JAVA_HOME and AXIS2_HOME must be defined prior to calling setenv.sh
export JAVA_HOME="/opt/tools/java/ejre1.6.0_10"
export AXIS2_HOME="/opt/tools/axis/axis2-1.5.1"

# Run setenv.sh to set environment variables $AXIS2_CLASSPATH
. $AXIS2_HOME/bin/setenv.sh || exit 0

# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=$JAVA_HOME/bin:/sbin:/usr/sbin:/bin:/usr/bin

DESC="Apache Axis2 web service engine"
NAME="axis2"
DAEMON="$JAVA_HOME/bin/java"
DAEMON_ARGS="-classpath $AXIS2_CLASSPATH
org.apache.axis2.transport.SimpleAxis2Server -repo $AXIS2_HOME/repository
-conf $AXIS2_HOME/conf/axis2.xm
l"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/axis2
#the user that will run the script
USER=root

# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh

# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions

#
# Function that starts the daemon/service
#
do_start()
{
   start-stop-daemon -b --start --quiet --chuid $USER -m -p $PIDFILE --exec
$DAEMON -- $DAEMON_ARGS || return 2
}

#
# Function that stops the daemon/service
#
do_stop()
{
   start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
   RETVAL="$?"
   rm -f $PIDFILE
   return "$RETVAL"
}

case "$1" in
  start)
    [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
    do_start
    case "$?" in
      0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
      2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  stop)
    [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
    do_stop
    case "$?" in
       0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
       2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
    esac
    ;;
  restart)
    #
    # If the "reload" option is implemented then remove the
    # 'force-reload' alias
    #
    log_daemon_msg "Restarting $DESC" "$NAME"
    do_stop
    case "$?" in
       0|1)
          do_start
          case "$?" in
             0) log_end_msg 0 ;;
             1) log_end_msg 1 ;; # Old process is still running
             *) log_end_msg 1 ;; # Failed to start
          esac
          ;;
       *)
          # Failed to stop
          log_end_msg 1
          ;;
    esac
    ;;
  *)
    echo "Usage: $SCRIPTNAME {start|stop|restart}" >&2
    exit 3
    ;;
esac

-- 
View this message in context: http://old.nabble.com/Startup-script-for-Axis2-tp29023324p29042409.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org