scenari
 

Comment passer SCENARIserver3.4 en service sous linux ?

  • Copier-coller le texte suivant dans votre éditeur de texte :

pour fedora

# This is the init script for starting up SCENARIserver.3.4
#
# chkconfig: 345 91 10
# description: Starts and stops the Tomcat daemon of SCENARIserver3.4.
#

#==============================================================================
# Server configuration

# Name of the server (used when printing out status).
serverName=SCENARIserver3.4

# Set this to the path of the tomcat folder.
tomcat=/opt/SCENARIserver3.4/tomcat

# Set this if you need to specify a specific JRE.
export JAVA_HOME=/opt/SCENARIserver3.4/jre

# SCENARIserver needs a minimum of 256Mb of heap space. Set these values
# according to your server's specifications.
export JAVA_OPTS=" -Xms512M -Xmx512M "

#==============================================================================
# OpenOffice Configuration

# Set DISPLAY variable if you want OpenOffice to use a specific display
export DISPLAY="localhost:1.0"

# If set this stops the recovery dialog prompting you as OO.o starts up
# after a crash - instead the recovery files are just silently
# accumulated.
export OOO_DISABLE_RECOVERY=1

#==============================================================================

# Source function library.
. /etc/rc.d/init.d/functions

# Get config.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

startup=$tomcat/bin/startup.sh
shutdown=$tomcat/bin/shutdown.sh

start(){
 action $"Starting $serverName: " $startup
 RETVAL=$?
 echo
}
stop(){
 action $"Stopping $serverName: " $shutdown
 RETVAL=$?
 echo
}
restart(){
  stop
  start
}

# See how we were called.
case "$1" in
start)
 start
 ;;
stop)
 stop
 ;;
status)
# This doesn't work ;)
# status SCENARIserver
 ;;
restart)
 restart
 ;;
*)
 echo $"Usage: $0 {start|stop|status|restart}"
 exit 1
esac

exit 0

pour ubuntu (testé avec 7.04) (avec en plus la possibilité de tourner avec un compte user)

#! /bin/bash
# This is the init script for starting up SCENARIserver.3.4
#
# chkconfig: 345 91 10
# description: Starts and stops the Tomcat daemon of SCENARIserver
#

#==============================================================================
# Server configuration

# Name of the server (used when printing out status).
serverName=SCENARIserver3.4

# Set this to the path of the tomcat folder.
tomcat=/opt/SCENARIserver3.4/tomcat

# user to run the tomcat server as
# (you have to create this user yourself, he must be owner or have write permission
# on tomcat webapp dir, scenari workshop dir and other temporary dirs)
runasuser=root

# Set this if you need to specify a specific JRE.
export JAVA_HOME=/opt/SCENARIserver3.4/jre
export PATH="$PATH:/usr/bin"

# SCENARIserver needs a minimum of 256Mb of heap space. Set these values
# according to your server's specifications.
export JAVA_OPTS=" -Xms300M -Xmx300M "

#==============================================================================
# OpenOffice Configuration

# Set DISPLAY variable if you want OpenOffice to use a specific display
export DISPLAY=":3.0"

# If set this stops the recovery dialog prompting you as OO.o starts up
# after a crash - instead the recovery files are just silently
# accumulated.
export OOO_DISABLE_RECOVERY=1

export UNO_PATH=/usr/lib/openoffice/program/

#==============================================================================

. /lib/lsb/init-functions

startup="su -s /bin/bash -c $tomcat/bin/startup.sh $runasuser"
shutdown="su -s /bin/bash -c $tomcat/bin/shutdown.sh $runasuser"

start(){
        log_begin_msg "Starting $serverName..."
        if $startup ; then
                log_end_msg 0
        else
                log_end_msg 1
        fi
}
stop(){
        log_begin_msg "Stoping $serverName..."
        if $shutdown ; then
                log_end_msg 0
        else
                log_end_msg 1
        fi
}
restart(){
        stop
        sleep 10
        start
}

# See how we were called.
case "$1" in
start)
        start
        ;;
stop)
        stop
        ;;
status)
        # This doesn't work ;)
        # status SCENARIserver
        echo "Status: not implemented"
        ;;
restart)
        restart
        ;;
*)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
esac

exit 0
  • Editez les lignes indiquant :
    • le répertoire de tomcat,
    • le répertoire de la JRE,
    • les options de lancement de la JRE,
    • le display utilisable pour openoffice
  • Sauvez le fichier dans /etc/init.d sous le nom SCENARIserver3.4 (ce répertoire est standard sur les distributions récentes)
  • Rendez le script exécutable: chmod a+x SCENARIserver3.4
  • Ajouter SCENARIserver au bon runlevel :
    • sous Fedora : chkconfig --add SCENARIserver3.4
    • sous Ubuntu : update-rc.d SCENARIserver3.4 defaults