]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1179 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 17 Sep 2007 15:40:48 +0000 (15:40 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Mon, 17 Sep 2007 15:40:48 +0000 (15:40 +0000)
Scripts/sogo-init.d-redhat
Scripts/sogod-redhat

index 68ac60d78b23678ce7c15a4b07a475e9754026f6..a63ca447c5cc1b6aa3a31915fecd78db4a712265 100755 (executable)
@@ -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
 #
 # 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
index 03cb492ab64b5b4de513f0bbca3da86712b62432..dfab9a75a3f8d54e6bfdc530787c6afd14408dc3 100755 (executable)
@@ -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
+