[Dive4elements-commits] [PATCH] Added SLES start script

Wald Commits scm-commit at wald.intevation.org
Wed Feb 27 17:00:18 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1361980812 -3600
# Node ID dc0cc18e7944855d210d6adaf5bebeb1e9a0f570
# Parent  842026a5a12c76880dc735824a7b4dc1d7c8c45b
Added SLES start script

diff -r 842026a5a12c -r dc0cc18e7944 contrib/init.d/README.txt
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/init.d/README.txt	Wed Feb 27 17:00:12 2013 +0100
@@ -0,0 +1,15 @@
+SLES-Init-Script fuer Dive4Elements River:
+
+Installation als root:
+- Kopieren nach /etc/init.d/d4e-river
+- chmod 755 /etc/init.d/d4e-river
+- insserv /etc/init.d/d4e-river
+- /etc/init.d/d4e-river start
+
+Deinstallation als root:
+- /etc/init.d/d4e-river stop
+- insserv -r /etc/init.d/d4e-river
+- rm /var/log/d4e-river.log /var/run/d4e-river.pid /etc/init.d/d4e-river
+
+TODO:
+- ggf. logrotate fuer Logdatei /var/log/d4e-river.log konfigurieren
diff -r 842026a5a12c -r dc0cc18e7944 contrib/init.d/d4e-river
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/init.d/d4e-river	Wed Feb 27 17:00:12 2013 +0100
@@ -0,0 +1,70 @@
+#!/bin/bash
+#
+### BEGIN INIT INFO
+# Provides: d4e-server
+# Required-Start: $network $syslog $remote_fs
+# Should-Start: $named $syslog $time
+# Required-Stop: $network $syslog
+# Should-Stop: $named $syslog $time
+# Default-Start:  3 5
+# Default-Stop:   0 1 2 6
+# Short-Description: Dive4Elements server
+# Description:    Start Dive4Elements server
+### END INIT INFO
+
+RUNAS=flys
+DIR="/opt/flys/current/server"
+
+CLASSPATH=
+for l in `find "$DIR/bin/lib" -name \*.jar -print`; do
+    CLASSPATH=$CLASSPATH:$l
+done
+
+
+LOGFILE=/var/log/d4e-river.log
+PIDFILE=/var/run/d4e-river.pid
+ARGS="-Xmx256m \
+     -server \
+     -Djava.awt.headless=true \
+     -Dflys.datacage.recommendations.development=false \
+     -Djava.io.tmpdir=\"$DIR/cache\" \
+     -Dflys.backend.enablejmx=true \
+     -Dflys.uesk.keep.artifactsdir=false \
+     -Dwsplgen.bin.path=\"$DIR/bin/wsplgen.exe\" \
+     -Dwsplgen.log.output=false \
+     -Dartifact.database.dir=\"$DIR/conf\""
+MAINCLASS=de.intevation.artifactdatabase.App
+
+# For SELinux we need to use 'runuser' not 'su'
+if [ -x "/sbin/runuser" ]; then
+    SU="/sbin/runuser"
+else
+    SU="/bin/su"
+fi
+
+case "$1" in
+  start)
+    echo "Starting D4E-river server..."
+    $SU - $RUNAS -c "/usr/bin/java -classpath $CLASSPATH $ARGS $MAINCLASS" &> $LOGFILE &
+    PID=$!
+    echo $PID > $PIDFILE
+    ;;
+  stop)
+    echo "Stopping D4E-river server..."
+    PID=`cat $PIDFILE`
+    STOPRES=0
+    while [ $STOPRES -le 0 ]
+    do
+      kill -15 $PID &> /dev/null
+      STOPRES=$?
+      sleep 1
+    done
+    echo "done."
+    ;;
+  restart)
+    $0 stop && $0 start
+    ;;
+  *)
+    echo "Usage: $0 [start|stop|restart]"
+esac
+


More information about the Dive4elements-commits mailing list