#!/bin/sh # # ilserver This shell script takes care of starting and stopping # the ILIAS java server subsystem (ilServer). # # chkconfig: - 64 36 # description: ILIAS ilServer. # processname: java # config: /etc/ilServer.ini # Source function library. . /etc/rc.d/init.d/functions prog="ilServer" javaexec="/usr/bin/java" iliasbase="/data/www/elearning/root" ilsrvbase="$iliasbase/Services/WebServices/RPC/lib" ilsrvconfig="$ilsrvbase/etc/ilServer.ini" ilsrvopts="-Dfile.encoding=UTF-8 -cp $ilsrvbase/fop-plugins/*:ilServer.jar de.ilias.ilServer $ilsrvconfig" exec="$javaexec $ilsrvopts" RETVAL=0 start(){ cd $ilsrvbase echo -n "Starting $prog: " STATUS=`$exec status` RETVAL=$? if ([ $STATUS == "Running" ] || [ $STATUS == "Runnning" ]); then echo -n "already started." failure $"$prog start" echo return $RETVAL fi $exec start & RETVAL=$? if [ $RETVAL -eq 0 ]; then success $"$prog start" else failure $"$prog start" fi echo return $RETVAL } stop(){ cd $ilsrvbase echo -n "Stopping $prog: " STATUS=`$exec status` RETVAL=$? if ([ $RETVAL -eq 0 ] && ([ $STATUS == "Running" ] || [ $STATUS == "Runnning" ])); then $exec stop success $"$prog shutdown" else echo -n "already stopped." failure $"$prog shutdown" fi echo return $RETVAL } status(){ cd $ilsrvbase STATUS=`$exec status` RETVAL=$? echo "$prog status: $STATUS" return $RETVAL } restart(){ stop sleep 2 start } # See how we were called. case "$1" in start) start RETVAL=$? ;; stop) stop RETVAL=$? ;; status) status RETVAL=$? ;; restart) restart RETVAL=$? ;; *) echo $"Usage: $0 {start|stop|status|restart}" RETVAL=1 ;; esac exit $RETVAL