]> err.no Git - scalable-opengroupware.org/blob - Scripts/sogod-wrapper
Install libs to /usr/lib
[scalable-opengroupware.org] / Scripts / sogod-wrapper
1 #!/bin/sh
2
3 # SOGo daemon wrapper
4 #
5 # Copyright (C) 2007 Inverse groupe conseil
6 #
7 # Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
8 #
9 # This file is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2, or (at your option)
12 # any later version.
13 #
14 # This file is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; see the file COPYING.  If not, write to
21 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 # Boston, MA 02111-1307, USA.
23
24 if [ -z "$1" ]
25 then
26   PIDFILE=/var/run/sogo/sogod.pid
27 else
28   PIDFILE=/var/run/sogo/sogod.$1
29 fi
30
31 if [ -d /usr/lib/GNUstep ]
32 then
33   . /usr/lib/GNUstep/System/Library/Makefiles/GNUstep.sh
34 else
35   . /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
36 fi
37
38 if [ -f $GNUSTEP_USER_ROOT/Tools/sogod-0.9 ]; then
39     sogod="$GNUSTEP_USER_ROOT/Tools/sogod-0.9"
40 elif [ -f $GNUSTEP_LOCAL_ROOT/Tools/sogod-0.9 ]; then
41     sogod="$GNUSTEP_LOCAL_ROOT/Tools/sogod-0.9"
42 elif [ -f $GNUSTEP_SYSTEM_ROOT/Tools/sogod-0.9 ]; then
43     sogod="$GNUSTEP_SYSTEM_ROOT/Tools/sogod-0.9"
44 else
45     echo "Can't find sogod-0.9"
46     exit 1
47 fi
48
49 echo $$ > $PIDFILE
50
51 startport=`defaults read sogod-0.9 WOPort`
52 if [ "$?" == "0" ]
53 then
54   startport=`echo $startport | awk '{print $3}'`
55 else
56   startport=20000
57 fi
58
59 if [ -z "$1" ]
60 then
61   port=$startport
62 else
63   let "port=$startport + $1 - 1"
64 fi
65
66 exec $sogod -WOPort $port >> /var/log/sogo/sogod-$port.log 2>&1 &