2007-05-03 21:02:56 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-07-24 20:40:20 +02:00
|
|
|
# SOGo daemon wrapper
|
|
|
|
#
|
2008-09-27 03:13:41 +02:00
|
|
|
# Copyright (C) 2007 Inverse inc.
|
2007-07-24 20:40:20 +02:00
|
|
|
#
|
|
|
|
# Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
|
|
#
|
|
|
|
# This file is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
# any later version.
|
|
|
|
#
|
|
|
|
# This file is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; see the file COPYING. If not, write to
|
|
|
|
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
# Boston, MA 02111-1307, USA.
|
|
|
|
|
2007-11-05 23:58:11 +01:00
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
PIDFILE=/var/run/sogo/sogod.pid
|
|
|
|
else
|
|
|
|
PIDFILE=/var/run/sogo/sogod.$1
|
|
|
|
fi
|
2007-05-03 21:02:56 +02:00
|
|
|
|
2007-11-05 23:56:12 +01:00
|
|
|
if [ -d /usr/lib/GNUstep ]
|
|
|
|
then
|
|
|
|
. /usr/lib/GNUstep/System/Library/Makefiles/GNUstep.sh
|
2008-02-14 19:47:19 +01:00
|
|
|
else
|
|
|
|
if [ -f /usr/share/GNUstep/Makefiles/GNUstep.sh ]
|
|
|
|
then
|
|
|
|
. /usr/share/GNUstep/Makefiles/GNUstep.sh
|
2007-11-05 23:56:12 +01:00
|
|
|
else
|
|
|
|
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
|
|
|
|
fi
|
2008-02-14 19:47:19 +01:00
|
|
|
fi
|
2007-05-03 21:02:56 +02:00
|
|
|
|
2009-03-19 02:22:09 +01:00
|
|
|
if [ -x $GNUSTEP_USER_ROOT/Tools/sogod ]; then
|
|
|
|
sogod="$GNUSTEP_USER_ROOT/Tools/sogod"
|
|
|
|
elif [ -x $GNUSTEP_LOCAL_ROOT/Tools/sogod ]; then
|
|
|
|
sogod="$GNUSTEP_LOCAL_ROOT/Tools/sogod"
|
|
|
|
elif [ -x $GNUSTEP_LOCAL_ROOT/Tools/Admin/sogod ]; then
|
|
|
|
sogod="$GNUSTEP_LOCAL_ROOT/Tools/Admin/sogod"
|
|
|
|
elif [ -x $GNUSTEP_SYSTEM_ROOT/Tools/sogod ]; then
|
|
|
|
sogod="$GNUSTEP_SYSTEM_ROOT/Tools/sogod"
|
|
|
|
elif [ -x $GNUSTEP_SYSTEM_ROOT/Tools/Admin/sogod ]; then
|
|
|
|
sogod="$GNUSTEP_SYSTEM_ROOT/Tools/Admin/sogod"
|
2007-10-31 18:15:24 +01:00
|
|
|
else
|
2009-03-19 02:22:09 +01:00
|
|
|
echo "Can't find sogod"
|
2007-10-31 18:15:24 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-03-19 02:22:09 +01:00
|
|
|
startport=`defaults read sogod WOPort`
|
2007-10-26 22:29:06 +02:00
|
|
|
if [ "$?" == "0" ]
|
|
|
|
then
|
|
|
|
startport=`echo $startport | awk '{print $3}'`
|
|
|
|
else
|
|
|
|
startport=20000
|
|
|
|
fi
|
|
|
|
|
2007-11-05 23:56:12 +01:00
|
|
|
if [ -z "$1" ]
|
|
|
|
then
|
|
|
|
port=$startport
|
|
|
|
else
|
|
|
|
let "port=$startport + $1 - 1"
|
|
|
|
fi
|
|
|
|
|
2009-04-01 15:38:46 +02:00
|
|
|
# echo "SOGOD: $sogod" 2>&1
|
2008-08-21 05:03:47 +02:00
|
|
|
|
2007-11-05 23:56:12 +01:00
|
|
|
exec $sogod -WOPort $port >> /var/log/sogo/sogod-$port.log 2>&1 &
|
2008-08-21 05:03:47 +02:00
|
|
|
echo $! > $PIDFILE
|