From a975db679947fe1580eac2363f5e6a4699bda728 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Mon, 17 Sep 2007 15:40:48 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1179 d1b88da0-ebda-0310-925b-ed51d893ca5b --- Scripts/sogo-init.d-redhat | 29 ++++++++++++++++------------- Scripts/sogod-redhat | 15 +++++++++++++-- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/Scripts/sogo-init.d-redhat b/Scripts/sogo-init.d-redhat index 68ac60d7..a63ca447 100755 --- a/Scripts/sogo-init.d-redhat +++ b/Scripts/sogo-init.d-redhat @@ -1,4 +1,10 @@ #!/bin/bash +# chkconfig: - 85 15 +# description: SOGo is a groupware server +# processname: sogod-0.9 +# config: /etc/sysconfig/sogo +# config: /etc/httpd/conf.d/SOGo.conf +# pidfile: /var/run/sogo/sogod.pid # SOGo init script for RedHat # @@ -22,18 +28,17 @@ # Boston, MA 02111-1307, USA. # sogod Scalable OpenGroupware.org (Inverse edition) -# -# chkconfig: - 85 15 -# description: SOGo is a groupware server -# processname: sogod-0.9 -# config: /etc/sysconfig/sogo -# config: /etc/httpd/conf.d/SOGo.conf -# pidfile: /var/run/sogo/sogod.pid PATH=/sbin:/bin:/usr/sbin:/usr/bin . /etc/rc.d/init.d/functions +if [ -z "$GNUSTEP_SYSTEM_ROOT" ] +then + . /usr/GNUstep/System/Library/Makefiles/GNUstep.sh +fi + +REAL_DAEMON=$GNUSTEP_SYSTEM_ROOT/Tools/sogod-0.9 DAEMON=/usr/sbin/sogod NAME=sogo DESC="Scalable OpenGroupware.Org (Inverse edition)" @@ -52,26 +57,24 @@ test -x $DAEMON || exit 0 case "$1" in start) - echo -n $"Starting $DESC: " / + echo -n $"Starting $DESC: " daemon --user sogo --pidfile $PIDFILE $DAEMON echo "$NAME." ;; stop) echo -n $"Stopping $DESC: " - killproc --pidfile $PIDFILE $DAEMON - rm -f $PIDFILE + killproc -p $PIDFILE $REAL_DAEMON && rm -f $PIDFILE echo "$NAME." ;; restart|force-reload) echo -n $"Restarting $DESC: " - killproc --pidfile $PIDFILE $DAEMON - rm -f $PIDFILE + killproc -p $PIDFILE $REAL_DAEMON && rm -f $PIDFILE sleep 1 daemon --user sogo --pidfile $PIDFILE $DAEMON echo "$NAME." ;; status) - status $DAEMON + status $REAL_DAEMON ;; *) N=/etc/init.d/$NAME diff --git a/Scripts/sogod-redhat b/Scripts/sogod-redhat index 03cb492a..dfab9a75 100755 --- a/Scripts/sogod-redhat +++ b/Scripts/sogod-redhat @@ -1,8 +1,19 @@ #!/bin/sh PIDFILE=/var/run/sogo/sogod.pid +PROGRAM=sogod-0.9 +oldpid=`pgrep -u $USER sogod-0.9` + +if [ -n "$oldpid" ] +then + echo SOGo already launched. + exit 1 +fi . /usr/GNUstep/System/Library/Makefiles/GNUstep.sh -echo $$ > $PIDFILE -exec $GNUSTEP_SYSTEM_ROOT/Tools/sogod-0.9 >& /var/log/sogo/sogod.log +$GNUSTEP_SYSTEM_ROOT/Tools/$PROGRAM >& /var/log/sogo/sogod.log & + +newpid=`pgrep -u $USER $PROGRAM | awk '{ print $1 }'` +echo $newpid > $PIDFILE + -- 2.39.5