opengroupware & nhsd service startup
#!/bin/sh
#
# Startup script for OpenGroupware on UNIX systems.
#
# Based on Henrik Holmboe script
# Changed for RedHat 9 By Yedidia Klein
# chkconfig: 2345 75 25 # description: OpenGroupware is a groupware server
# Configuration section
OGO_DIR=/opt/opengroupware.org
OGO_BIN=$OGO_DIR/WOApps/OpenGroupware.woa/ix86/linux-gnu/gnu-fd-nil/OpenGroupware
OGO_ARGS="-WOPort 20000 -WOHttpAllowHost localhost, myhost.mydomain.foo -OGoMinimumActiveSessionCount 0"
PID_FILE=/var/run/ogo.pid
LOG=/var/log/ogo.log
# added by eharren 2004-05-07 NHSD_BIN="$OGO_DIR/Tools/ix86/linux-gnu/gnu-fd-nil/nhsd" NHSD_ARGS="" NHSD_PID_FILE=/var/run/nhsd.pid NHSD_LOG=/var/log/nhsd.log
# end configuration section
# Source function library. # Use the funtions provided by Red Hat or use our own if [ -f /etc/rc.d/init.d/functions ] then . /etc/rc.d/init.d/functions else function action { echo "$1" shift $@ } function success { echo -n "Success" } function failure { echo -n "Failed" } fi
[ -x $OGO_BIN ] || exit 0
case "$1" in start) echo -n "Starting OpenGroupware: " pushd $OGO_DIR > /dev/null
# log separator echo "----------------------------------------------------------------------" >> $LOG
# run as a user 'opengroupware': if [ "`uname -s`" = "Linux" ]; then env -i su - opengroupware -c "$OGO_BIN $OGO_ARGS" >> $LOG 2>&1 & elif [ "`uname -s`" = "FreeBSD" ]; then env -i su -l opengroupware -c "$OGO_BIN $OGO_ARGS" >> $LOG 2>&1 & fi
echo $! > $PID_FILE popd > /dev/null success "Starting OpenGroupware" echo
# Script-origin by Olivier Hallot for nhsd daemon for palm sync # changed by eharren 2004-05-07
echo -n "Starting Palm Sync daemon: " pushd $OGO_DIR > /dev/null
# run as a user 'opengroupware': if [ "`uname -s`" = "Linux" ]; then env -i su - opengroupware -c "$NHSD_BIN $NHSD_ARGS" >> $NHSD_LOG 2>&1 & elif [ "`uname -s`" = "FreeBSD" ]; then env -i su -l opengroupware -c "$NHSD_BIN $NHSD_ARGS" >> $LOG 2>&1 & fi
echo $! > $NHSD_PID_FILE popd > /dev/null success "Starting Palm Sync daemon" echo ;;
stop) echo -n "Shutting down OpenGroupware: " if test -f "$PID_FILE" ; then PID=`cat $PID_FILE` if kill $PID >> $LOG 2>&1 ; then /bin/rm $PID_FILE success "Shutting down OpenGroupware" else echo "" echo "Could not kill process $PID named in $PID_FILE. Check tail of $LOG." failure "Shutting down OpenGroupware" fi else echo "" echo "No OpenGroupware pid file found. Looked for $PID_FILE." failure "No OpenGroupware pid file found. Looked for $PID_FILE." fi echo
# Added by Erik Harren # for stopping nhsd daemon for palm sync
echo -n "Shutting down NHSD-daemon: " if test -f "$NHSD_PID_FILE" ; then NHSD_PID=`cat $NHSD_PID_FILE` if kill $NHSD_PID >> $NHSD_LOG 2>&1 ; then /bin/rm $NHSD_PID_FILE success "Shutting down NHSD-Daemon" else echo "" echo "Could not kill process $NHSD_PID named in $NHSD_PID_FILE. Check tail of $NHSD_LOG." failure "Shutting down NHSD-Daemon" fi else echo "" echo "No NHSD-daemon pid file found. Looked for $NHSD_PID_FILE." failure "No NHSD-daemon pid file found. Looked for $NHSD_PID_FILE." fi echo ;;
restart) $0 stop $0 start ;;
*) echo "Usage: opengroupware {start|stop|restart}" exit 1
esac
exit 0