#!/sbin/runscript # $Header$ depend() { need net use apache2 cyrus tomcat5 saslauthd postgresql slapd } pidfile_sessiond=${PIDFILE-/var/run/ox_sessiond.pid} pidfile_groupware=${PIDFILE-/var/run/ox_groupware.pid} pidfile_webmail=${PIDFILE-/var/run/ox_webmail.pid} USER=tomcat OX_SESSIOND_BIN="/opt/openexchange/bin/openexchange-sessiond" OX_GROUPWARE_BIN="/opt/openexchange/bin/openexchange-groupware" OX_WEBMAIL_BIN="/opt/openexchange/bin/openexchange-webmail" PROG_NAME="Open-Xchange" start() { ebegin "Starting $PROG_NAME (sessiond)" start-stop-daemon -c $USER --start --quiet --background --pidfile $pidfile_sessiond --make-pidfile --exec $OX_SESSIOND_BIN STAT=$? [ $STAT -eq 0 ] && { RUN_PID=`cat $pidfile_sessiond` RUNNING=`ps aux | grep $USER | grep $RUN_PID | grep -v grep | wc -l` [ $RUNNING -ne 1 ] && { rm $pidfile_sessiond STAT=1 } } eend $STAT ebegin "Starting $PROG_NAME (groupware)" start-stop-daemon -c $USER --start --quiet --background --pidfile $pidfile_groupware --make-pidfile --exec $OX_GROUPWARE_BIN STAT=$? [ $STAT -eq 0 ] && { RUN_PID=`cat $pidfile_groupware` RUNNING=`ps aux | grep $USER | grep $RUN_PID | grep -v grep | wc -l` [ $RUNNING -ne 1 ] && { rm $pidfile_groupware STAT=1 } } eend $STAT ebegin "Starting $PROG_NAME (webmail)" start-stop-daemon -c $USER --start --quiet --background --pidfile $pidfile_webmail --make-pidfile --exec $OX_WEBMAIL_BIN STAT=$? [ $STAT -eq 0 ] && { RUN_PID=`cat $pidfile_webmail` RUNNING=`ps aux | grep $USER | grep $RUN_PID | grep -v grep | wc -l` [ $RUNNING -ne 1 ] && { rm $pidfile_webmail STAT=1 } } eend $STAT } stop() { ebegin "Stopping $PROG_NAME (sessiond)" start-stop-daemon --stop --quiet --pidfile $pidfile_sessiond eend $? ebegin "Stopping $PROG_NAME (groupware)" start-stop-daemon --stop --quiet --pidfile $pidfile_groupware eend $? ebegin "Stopping $PROG_NAME (webmail)" start-stop-daemon --stop --quiet --pidfile $pidfile_webmail eend $? [ -f $pidfile_sessiond ] && rm $pidfile_sessiond [ -f $pidfile_groupware ] && rm $pidfile_groupware [ -f $pidfile_webmail ] && rm $pidfile_webmail }