From 85e8088e40acd770e0b80176d91eb95aeacce2b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobi=20Sch=C3=A4fer?= Date: Sun, 18 Apr 2021 19:50:07 +0200 Subject: [PATCH] Clean up upstart files --- src/dist/extras/upstart/helma | 66 ++++++++++++--------- src/dist/extras/upstart/helma.conf | 92 +++++++++++------------------- 2 files changed, 71 insertions(+), 87 deletions(-) diff --git a/src/dist/extras/upstart/helma b/src/dist/extras/upstart/helma index e7f1229f..46bbf66c 100755 --- a/src/dist/extras/upstart/helma +++ b/src/dist/extras/upstart/helma @@ -6,56 +6,67 @@ # andreas bolka, 2003-11-30 # +### BEGIN INIT INFO +# Provides: helma +# Required-Start: postgresql apache2 +# Required-Stop: +# Default-Start: 2 3 4 5 +# Default-STop: 0 1 6 +# Short-Description: Helma Application Server +### END INIT INFO + HELMA_CONFIG=/etc/helma.conf ### # Check for existence of needed config file and source it if [ -r $HELMA_CONFIG ]; then - source $HELMA_CONFIG + source $HELMA_CONFIG else - echo "Can't read config file $HELMA_CONFIG" - exit 6 + echo "Can't read config file $HELMA_CONFIG" + exit 6 fi # Check for missing files and directories + if [ ! -x $JAVA_BIN ]; then - echo "Config error: JAVA_BIN $JAVA_BIN not found or not executable" - exit 5 -fi -if [ ! -r $HELMA_INSTALL/launcher.jar ]; then - echo "Config error: $HELMA_INSTALL/launcher.jar not found or not readable" - exit 5 -fi -if [ ! -d $HELMA_HOME ]; then - echo "Config error: HELMA_HOME $HELMA_HOME not found" - exit 5 + echo "Config error: JAVA_BIN $JAVA_BIN not found or not executable" + exit 5 fi -# local settins -RUN_CMD="sudo -u $HELMA_USER $JAVA_BIN" -RUN_ARGS="$JAVA_OPTS -jar $HELMA_INSTALL/launcher.jar -h $HELMA_HOME $HELMA_ARGS" +if [ ! -r $HELMA_INSTALL/launcher.jar ]; then + echo "Config error: $HELMA_INSTALL/launcher.jar not found or not readable" + exit 5 +fi + +if [ ! -d $HELMA_HOME ]; then + echo "Config error: HELMA_HOME $HELMA_HOME not found" + exit 5 +fi + +RUN_CMD="su - $HELMA_USER" +RUN_ARGS="-c $JAVA_BIN $JAVA_OPTS -jar $HELMA_INSTALL/launcher.jar -h $HELMA_HOME $HELMA_ARGS" case "$1" in -start) + start) echo -n "Starting $HELMA_SERVICE: " if [ -f $HELMA_PID ]; then - echo "$HELMA_SERVICE (pid `cat $HELMA_PID`) already running" - exit 1 + echo "$HELMA_SERVICE (pid `cat $HELMA_PID`) already running" + exit 1 fi cd $HELMA_HOME - nohup $RUN_CMD $RUN_ARGS > $HELMA_LOG 2>&1 & + nohup $RUN_CMD "$RUN_ARGS" > $HELMA_LOG 2>&1 & echo $! > $HELMA_PID echo "$HELMA_SERVICE (pid `cat $HELMA_PID`) started." ;; -stop) + stop) echo -n "Shutting down $HELMA_SERVICE: " if [ ! -f $HELMA_PID ]; then - echo "$HELMA_SERVICE not running" - exit 1 + echo "$HELMA_SERVICE not running" + exit 1 fi PID=`cat $HELMA_PID 2>/dev/null` @@ -65,20 +76,21 @@ stop) echo "stopped." ;; -restart) + restart) $0 stop && $0 start ;; -reload) + reload) echo -n "Reloading $HELMA_SERVICE: $HELMA_SERVICE" touch $HELMA_HOME/server.properties touch $HELMA_HOME/apps.properties echo "." ;; -*) + *) echo "Usage: /etc/init.d/helma start|stop|restart|reload" - exit 1 + exit 1 ;; esac + exit 0 diff --git a/src/dist/extras/upstart/helma.conf b/src/dist/extras/upstart/helma.conf index 2fb8c80f..521320c2 100644 --- a/src/dist/extras/upstart/helma.conf +++ b/src/dist/extras/upstart/helma.conf @@ -1,72 +1,44 @@ -############################################################## -### -### Helma object publisher config file -### Author: Hannes Wallnoefer, -### Author: Andreas Bolka -### -### This file should be placed in /etc/helma.conf. -### It is read by the Helma service control script, -### usually /etc/init.d/helma. -### -############################################################## +# +# Helma Object Publisher configuration file +# +# Authors: +# Hannes Wallnoefer , +# Andreas Bolka +# +# This file should be placed in /etc/helma.conf. +# It is read by the Helma service control script, +# usually /etc/init.d/helma. +# -############################################################## -### The name of this Helma server/service and the -### pid file to be used -############################################################# +# Full path to Java executable +JAVA_HOME=/usr/lib/jvm/default-java +JAVA_BIN=$JAVA_HOME/bin/java + +# Options passed to the Java runtime +JAVA_OPTS="-server -Djava.awt.headless=true -Dfile.encoding=utf-8 -Djsse.enableSNIExtension=false" + +# The name of this Helma server/service and the pid file to be used HELMA_SERVICE=helma HELMA_PID=/var/run/helma.pid +# Helma install directory. This is where we look for the Helma jar files +# (launcher.jar, lib/* and lib/ext/*) +HELMA_INSTALL=/home/helma -############################################################## -### Full path to Java executable -############################################################## -JAVA_HOME=/usr/lib/j2sdk1.5-sun -JAVA_BIN=$JAVA_HOME/bin/java - - -############################################################## -### Options passed to the Java runtime -############################################################## -JAVA_OPTS="-Djava.awt.headless=true" - - -############################################################## -### Helma install directory. This is where we look for -### the Helma jar files (launcher.jar, lib/* and lib/ext/*) -############################################################## -HELMA_INSTALL=/usr/local/helma/helma-1.6.x - - -############################################################## -### Helma home directory, in case it is different from the -### Helma install dir. This is where Helma will look for -### properties files and applications. -############################################################## +# Helma home directory, in case it is different from the Helma install dir. +# This is where Helma will look for properties files and applications. HELMA_HOME=$HELMA_INSTALL - -############################################################## -### The user Helma should be running as -############################################################## +# The user Helma should be running as HELMA_USER=helma - -############################################################## -### File to which standard and error output from Helma -### is redirected -############################################################## +# File to which standard and error output from Helma is redirected HELMA_LOG=$HELMA_HOME/log/helma-out.log - -############################################################## -### Helma options. Possible options are: -### -### -f file Specify server.properties file -### -p port Specify RMI port number -### -w port Specify port number for embedded Web server -### -x port Specify XML-RPC port number -### -jk port Specify AJP13 port number -### -############################################################## +# Helma options. Possible options are: +# -f file - Location of server.properties file +# -p port - RMI port +# -w port - Web server port +# -x port - XML-RPC port +# -jk port - AJP13 port HELMA_ARGS="-w 8080"