2007-05-03 21:02:56 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-07-24 20:40:20 +02:00
|
|
|
# SOGo daemon wrapper
|
|
|
|
#
|
2009-04-06 14:54:03 +02:00
|
|
|
# Copyright (C) 2007-2009 Inverse inc.
|
2007-07-24 20:40:20 +02:00
|
|
|
#
|
|
|
|
# Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
2009-05-20 00:49:50 +02:00
|
|
|
# Francis Lachapelle <flachapelle@inverse.ca>
|
2007-07-24 20:40:20 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
2009-04-21 17:20:52 +02:00
|
|
|
# Uncomment the following line for Oracle RAC. This is where
|
|
|
|
# should be located the tnsnames.ora.
|
|
|
|
#export TNS_ADMIN=/home/sogo
|
|
|
|
|
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
|
|
|
|
2009-05-20 00:49:50 +02:00
|
|
|
if [ -f /etc/GNUstep/GNUstep.conf ]; then
|
|
|
|
. /etc/GNUstep/GNUstep.conf
|
2007-11-05 23:56:12 +01:00
|
|
|
else
|
2009-05-20 00:49:50 +02:00
|
|
|
echo "Can't find GNUstep.conf"
|
|
|
|
exit 1
|
2008-02-14 19:47:19 +01:00
|
|
|
fi
|
2007-05-03 21:02:56 +02:00
|
|
|
|
2009-06-02 15:47:11 +02:00
|
|
|
if [ -x $HOME/$GNUSTEP_USER_DIR_ADMIN_TOOLS/sogod ]; then
|
|
|
|
sogod="$HOME/$GNUSTEP_USER_DIR_ADMIN_TOOLS/sogod"
|
|
|
|
elif [ -x $GNUSTEP_LOCAL_ADMIN_TOOLS/sogod ]; then
|
2009-05-20 00:49:50 +02:00
|
|
|
sogod="$GNUSTEP_LOCAL_ADMIN_TOOLS/sogod"
|
2009-05-21 20:59:12 +02:00
|
|
|
elif [ -x $GNUSTEP_SYSTEM_ADMIN_TOOLS/sogod ]; then
|
|
|
|
sogod="$GNUSTEP_SYSTEM_ADMIN_TOOLS/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-05-20 00:49:50 +02:00
|
|
|
if [ -f $GNUSTEP_MAKEFILES/GNUstep.sh ]; then
|
|
|
|
. $GNUSTEP_MAKEFILES/GNUstep.sh
|
|
|
|
else
|
|
|
|
echo "Can't find GNUstep.sh"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2009-04-06 14:54:03 +02:00
|
|
|
woport=`defaults read sogod WOPort`
|
2007-10-26 22:29:06 +02:00
|
|
|
if [ "$?" == "0" ]
|
|
|
|
then
|
2009-04-06 14:54:03 +02:00
|
|
|
startport=`echo $woport | awk '{print $3}' | sed -e 's/\(.*:\)//'`
|
2007-10-26 22:29:06 +02:00
|
|
|
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-06 14:54:03 +02:00
|
|
|
listen=`echo $woport | awk '{ print $3 }' | sed -e 's/\([0-9]\+\)$/'$port'/g'`
|
2007-11-05 23:56:12 +01:00
|
|
|
|
2009-05-20 00:49:50 +02:00
|
|
|
# echo "SOGOD: $sogod -WOPort $listen" 2>&1
|
2008-08-21 05:03:47 +02:00
|
|
|
|
2009-04-06 14:54:03 +02:00
|
|
|
exec $sogod -WOPort $listen >> /var/log/sogo/sogod-$port.log 2>&1 &
|
2008-08-21 05:03:47 +02:00
|
|
|
echo $! > $PIDFILE
|