Adding Linux start script from Andreas Bolka

This commit is contained in:
hns 2003-12-01 15:18:45 +00:00
parent 18922d4e37
commit 98386829cf
3 changed files with 169 additions and 0 deletions

19
scripts/README.txt Normal file
View file

@ -0,0 +1,19 @@
This is a startup script for Helma written by Andreas Bolka. It allows
you to automatically run Helma as a service on Linux and Unix hosts.
It was originally written for Debian GNU/Linux, but was successfully
tested on SuSE Linux and should work for most Linux and Unix platforms.
If you are looking for a way to run Helma as Service on a Windows
machine, have a look at HelmaService:
http://adele.helma.org/download/helma/contrib/hannes/helmaservice/
If you experience any problems running Helma as service on Linux,
Windows or Unix box, please drop us a note on the Helma User Mailing
List:
http://helma.org/development/mailinglists/

84
scripts/helma Executable file
View file

@ -0,0 +1,84 @@
#!/bin/sh
#
# helma init script (written for debian, but should be rather generic)
# needs helma.conf, preferrably in /etc/helma.conf
#
# andreas bolka, 2003-11-30
#
HELMA_CONFIG=/etc/helma.conf
###
# Check for existence of needed config file and source it
if [ -r $HELMA_CONFIG ]; then
source $HELMA_CONFIG
else
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
fi
# local settins
RUN_CMD=$JAVA_BIN
RUN_ARGS="$JAVA_OPTS -jar $HELMA_HOME/launcher.jar $HELMA_ARGS"
case "$1" in
start)
echo -n "Starting $HELMA_SERVICE: "
if [ -f $HELMA_PID ]; then
echo "$HELMA_SERVICE (pid `cat $HELMA_PID`) already running"
exit 1
fi
cd $HELMA_HOME
nohup $RUN_CMD $RUN_ARGS > $HELMA_LOG 2>&1 &
echo $! > $HELMA_PID
echo "$HELMA_SERVICE (pid `cat $HELMA_PID`) started."
;;
stop)
echo -n "Shutting down $HELMA_SERVICE: "
if [ ! -f $HELMA_PID ]; then
echo "$HELMA_SERVICE not running"
exit 1
fi
PID=`cat $HELMA_PID 2>/dev/null`
echo -n "$HELMA_SERVICE (pid $PID) "
kill $PID 2>/dev/null; sleep 2; kill -9 $PID 2>/dev/null
rm -f $HELMA_PID
echo "stopped."
;;
restart)
$0 stop && $0 start
;;
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
;;
esac
exit 0

66
scripts/helma.conf Normal file
View file

@ -0,0 +1,66 @@
##############################################################
###
### Helma object publisher config file
### Author: Hannes Wallnoefer, <hannes@helma.at>
### 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.
###
##############################################################
##############################################################
### The name of this Helma server/service and the
### pid file to be used
#############################################################
HELMA_SERVICE=helma
HELMA_PID=/var/run/helma.pid
##############################################################
### Full path to Java executable
##############################################################
JAVA_HOME=/usr/local/java/sun-j2sdk1.4.2_02
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.3.1
##############################################################
### 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
##############################################################
### 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_ARGS="-w 8080"