directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alex Karasulu" <akaras...@apache.org>
Subject Re: [RPM Installer] Generic start/stop shell script
Date Tue, 27 Mar 2007 15:20:31 GMT
We might want to look at making some things like the min max heap sizes
variable with defaults.  However this we can do
later after getting everything working.

Alex


On 3/21/07, Ole Ersoy <ole.ersoy@gmail.com> wrote:
>
> I've tried to reduce our start/stop shell script to a minimum needed
> for RPM (I think Solaris, Mac, *NIX in general).
>
> I still need to test it out of coarse, but I thought I'd throw it out
> here in case anyone has a chance to kick it.
>
> Just substitute apacheds for ${name} (It's a pseudo template - The final
> one will be a jet template....)
>
>
> #!/bin/bash
> #
> # chkconfig: - 91 35
> # description: Starts and stops ${name} server.
> #
> # Shell script to start/stop ${name}
> # If you want to change ${name} service settings please modify the
> server.xml
> # file.
> #
>
>
> # Source function library.
> if [ -f /etc/init.d/functions ] ; then
>     . /etc/init.d/functions
> fi
>
> # Source networking configuration.
> if [ -f /etc/sysconfig/network ] ; then
>     . /etc/sysconfig/network
> fi
>
> # Check that networking is up.
> if [ ! -z "$NETWORKING" ] ; then
>      if [ "$NETWORKING" = "no" ] ; then
>           exit 0
>      fi
> fi
>
> prog=$"${name} server"
> StringUtils.toUpperCase(${name})_HOME=/usr/share/${name}-${version}
> #So for ApacheDS this would be
> # APACHEDS_HOME = /usr/share/apacheds-1.0.1
>
> if [ -z "$JAVA_HOME" ] ; then
> echo "Error: JAVA_HOME environment variable is not set."
> echo "You will need to set the JAVA_HOME environment variable to"
> echo "the the path of the root java  installation directory."
> echo "See the installation guide for further instructions."
> else
> echo JAVA_HOME=$JAVA_HOME
> fi
>
>
> DAEMON_HOME=$APACHEDS_HOME/bin
> CLASSPATH=$CLASSPATH:$JAVA_HOME/lib/tools.jar
>
> #The statement below will probably be shortened to
> #$DAEMON_HOME/bootstrapper.jar
> #when we figure out how to use the daemon and logger from
> /usr/share/java instead.
>
>
> CLASSPATH=$CLASSPATH:$DAEMON_HOME/bootstrapper.jar:$DAEMON_HOME/logger.jar:$DAEMON_HOME/daemon.jar
> echo CLASSPATH=$CLASSPATH
> StringUtils.toUpperCase(${name})_USER=$USER
>
> TMP_DIR=/var/tmp/${name}-${version}
> PID_FILE=/var/run/${name}-${version}/server.pid
>
> cd $StringUtils.toUpperCase(${name})_HOME
>
> case "$1" in
> start)
>    #
>    # Start apacheds
>    #
>    echo -n $"Starting $prog: "
>    ulimit -S -c 0 >/dev/null 2>&1
>    RETVAL=0
>
>    $DAEMON_HOME/apacheds \
>    -user $StringUtils.toUpperCase(${name})_USER \
>    -home $JAVA_HOME \
>    -Djava.io.tmpdir=$TMP_DIR \
>
> -Dlog4j.configuration=file://etc/conf/${name}-${version}/log4j.properties\
>    -Xms384m -Xmx384m \
>    -pidfile $PID_FILE \
>    -outfile /var/log/${name}-${version}/${name}-stdout.log \
>    -errfile /var/log/${name}-${version}/${name}-stderr.log \
>    -cp $CLASSPATH \
>    org.apache.directory.daemon.JsvcBootstrapper \
>    $StringUtils.toUpperCase(${name})_HOME start
>
>    [ "$RETVAL" -eq 0 ] && success $"apacheds server startup" || \
>         failure $"${name} server start"
>    echo
>    if [ -d /var/lock/subsys ] ; then
>           [ "$RETVAL" -eq 0 ] && touch
> /var/${name}-${version}/apacheds.lock
>    fi
>
>    exit $RETVAL
>    ;;
>
> stop)
>    #
>    # Stop ${name}
>    #
>    echo -n $"Shutting down $prog: "
>    RETVAL=0
>
>    $DAEMON_HOME/${name} \
>    -stop \
>    -pidfile $PID_FILE \
>
> -Dlog4j.configuration=file://etc/conf/${name}-${version}/log4j.properties\
>    org.apache.directory.daemon.JsvcBootstrapper stop
>
>     [ "$RETVAL" -eq 0 ] && success $"apacheds server shutdown" || \
>          failure $"apacheds server shutdown"
>     echo
>     if [ -d /var/lock/subsys/apacheds ] ; then
>            [ "$RETVAL" -eq 0 ] && rm $APACHEDS_HOME/var/apacheds.lock
>     fi
>
>    exit $RETVAL
>    ;;
>
> debug)
>    #
>    # Debug ${name}
>    #
>    echo -n $"Starting $prog in debug mode: "
>    ulimit -S -c 0 >/dev/null 2>&1
>    RETVAL=0
>
>    if [ -z "$2" ] ; then
>      echo
>      echo ========================================================
>      echo "Warning: the debug port is not set. Using 5005 default."
>      echo ========================================================
>      echo
>      DEBUG_PORT=5005
>    else
>      DEBUG_PORT="$2"
>    fi
>
>    $JAVA_HOME/bin/java\
>
> -Dlog4j.configuration=file://$StringUtils.toUpperCase
> (${name})_HOME/conf/log4j.properties\
>    -Xms384m -Xmx384m \
>    -Dcom.sun.management.jmxremote \
>    -Xdebug -Xnoagent -Djava.compiler=NONE\
>    -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=$DEBUG_PORT\
>    -jar $DAEMON_HOME/bootstrapper.jar \
>    $StringUtils.toUpperCase(${name})_HOME start
>    ;;
>
> *)
>    echo "Usage ${name} [start|stop|debug]"
>    exit 1;;
> esac
>
>
>
>

Mime
View raw message