Monotone-Parent: ff9ecdad5c2aaadfaee83c65c66e64abcf91ccac

Monotone-Revision: 70da0038473c195e4432eef83ea8e60444efb5e6

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-10-26T20:29:06
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-10-26 20:29:06 +00:00
parent e454587e2a
commit 91d10b14b5
7 changed files with 115 additions and 173 deletions

View File

@ -1,10 +1,11 @@
#! /bin/sh
#! /bin/bash
# SOGo init script for Debian GNU/Linux
#
# Copyright (C) 2007 Inverse groupe conseil
#
# Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
# Ludovic Marcotte <ludovic@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
@ -21,47 +22,63 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
PREFORK=3
SOGO_ARGS=""
PATH=/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/sogod-0.9
NAME=sogo
DESC="Scalable OpenGroupware.Org"
PIDFILE=/var/run/sogo/sogod.pid
SOGO_ARGS=""
PIDFILE=/var/run/sogo/sogod.
if [ -f /etc/default/sogo ]; then
. /etc/default/sogo
fi
test -x $DAEMON || exit 0
if [ ! -x $DAEMON ]; then
echo "$DAEMON is not executable."
exit 1
fi
#set -e
if [ `/usr/bin/stat /var/run/sogo -c %U` != "sogo" ]; then
echo "/var/run/sogo is not owned by the sogo user."
exit 1
fi
if [ `/usr/bin/stat /var/spool/sogo -c %U` != "sogo" ]; then
echo "/var/spool/sogo is not owned by the sogo user."
exit 1
fi
if [ `/usr/bin/stat /var/log/sogo -c %U` != "sogo" ]; then
echo "/var/log/sogo is not owned by the sogo user."
exit 1
fi
case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon -c sogo --pidfile $PIDFILE \
-b --start --quiet --exec $DAEMON
for ((a=1; a <= PREFORK ; a++))
do
start-stop-daemon -c sogo --pidfile $PIDFILE$a \
-b --start --quiet --exec $DAEMON $a
done
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
sogopid=$(cat $PIDFILE)
kill ${sogopid} 2> /dev/null
rm -f $PIDFILE
for ((a=1; a <= PREFORK ; a++))
do
sogopid=$(cat $PIDFILE$a)
kill ${sogopid} 2> /dev/null
rm -f $PIDFILE$a
done
echo "$NAME."
;;
restart|force-reload)
echo -n "Restarting $DESC: "
sogopid=$(cat $PIDFILE)
kill ${sogopid} 2> /dev/null
rm -f $PIDFILE
sleep 1
start-stop-daemon -c sogo --pidfile $PIDFILE \
-b --start --quiet --exec $DAEMON
echo "$NAME."
$0 stop && sleep 2 && $0 start
;;
*)
N=/etc/init.d/$NAME

View File

@ -29,6 +29,9 @@
# sogod Scalable OpenGroupware.org (Inverse edition)
PREFORK=3
SOGO_ARGS=""
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /etc/rc.d/init.d/functions
@ -43,34 +46,50 @@ DAEMON=/usr/sbin/sogod
NAME=sogo
DESC="Scalable OpenGroupware.Org (Inverse edition)"
PIDFILE=/var/run/sogo/sogod.pid
SOGO_ARGS=""
PIDFILE=/var/run/sogo/sogod.
if [ -f /etc/sysconfig/sogo ]; then
. /etc/sysconfig/sogo
fi
test -x $DAEMON || exit 0
if [ ! -x $DAEMON ]; then
echo "$DAEMON is not executable."
exit 1
fi
if [ `/usr/bin/stat /var/run/sogo -c %U` != "sogo" ]; then
echo "/var/run/sogo is not owned by the sogo user."
exit 1
fi
if [ `/usr/bin/stat /var/spool/sogo -c %U` != "sogo" ]; then
echo "/var/spool/sogo is not owned by the sogo user."
exit 1
fi
if [ `/usr/bin/stat /var/log/sogo -c %U` != "sogo" ]; then
echo "/var/log/sogo is not owned by the sogo user."
exit 1
fi
#set -e
case "$1" in
start)
echo -n $"Starting $DESC: "
daemon --user sogo --pidfile $PIDFILE $DAEMON
daemon su - sogo -c $DAEMON
# daemon --user sogo --pidfile $PIDFILE $DAEMON
echo "$NAME."
;;
stop)
echo -n $"Stopping $DESC: "
killproc -p $PIDFILE $REAL_DAEMON && rm -f $PIDFILE
killproc `basename $REAL_DAEMON` && rm -f $PIDFILE
# killproc -p $PIDFILE $REAL_DAEMON && rm -f $PIDFILE
echo "$NAME."
;;
restart|force-reload)
echo -n $"Restarting $DESC: "
killproc -p $PIDFILE $REAL_DAEMON && rm -f $PIDFILE
sleep 1
daemon --user sogo --pidfile $PIDFILE $DAEMON
$0 stop && sleep 2 && $0 start
echo "$NAME."
;;
status)
@ -84,4 +103,3 @@ case "$1" in
esac
exit 0

View File

@ -1,87 +0,0 @@
#!/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
#
# Copyright (C) 2007 Inverse groupe conseil
#
# 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.
# sogod Scalable OpenGroupware.org (Inverse edition)
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)"
PIDFILE=/var/run/sogo/sogod.pid
SOGO_ARGS=""
if [ -f /etc/sysconfig/sogo ]; then
. /etc/sysconfig/sogo
fi
test -x $DAEMON || exit 0
#set -e
case "$1" in
start)
echo -n $"Starting $DESC: "
daemon su - sogo -c $DAEMON
echo "$NAME."
;;
stop)
echo -n $"Stopping $DESC: "
killproc `basename $REAL_DAEMON` && rm -f $PIDFILE
echo "$NAME."
;;
restart|force-reload)
echo -n $"Restarting $DESC: "
killproc `basename $REAL_DAEMON` && rm -f $PIDFILE
sleep 1
daemon su - sogo -c $DAEMON
echo "$NAME."
;;
status)
status $REAL_DAEMON
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
exit 1
;;
esac
exit 0

View File

@ -1,36 +0,0 @@
#!/bin/sh
export PATH=/usr/local/sbin:$PATH
cd /root/SOGo
# echo "Pulling monotone repository"
oldversion=$(mtn status)
mtn pull >& /dev/null
mtn update >& /dev/null
newversion=$(mtn status)
if [ "$oldversion" == "$newversion" ]
then
exit 0
fi
echo "SOGo mainsite updated at $(date)..."
. /root/GNUstep/Library/Makefiles/GNUstep.sh >& /dev/null
make distclean > /dev/null
./configure --disable-strip --without-gnustep >& /dev/null
make -s > /dev/null
rm -rf /usr/local/lib/sogod-0.9
make -s install > /dev/null
# echo "Copying templates to /usr/local/share/sogo-0.9/templates"
# rm -rf /usr/local/share/sogo-0.9/templates
# cp -a UI/Templates /usr/local/share/sogo-0.9/templates
# echo "Copying web resources to /usr/local/share/sogo-0.9/www"
# cp -a UI/WebServerResources /usr/local/share/sogo-0.9/www
# echo "Killing server"
pkill sogod-0.9 >& /dev/null
# echo "Starting sogod-0.9 (log in /var/log/sogod)"
echo "Launching on $(date)" > /var/log/sogod
sogod-0.9 >> /var/log/sogod 2>&1 &

View File

@ -21,9 +21,19 @@
# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
PIDFILE=/var/run/sogo/sogod.pid
PIDFILE=/var/run/sogo/sogod.$1
. /usr/lib/GNUstep/System/Library/Makefiles/GNUstep.sh
echo $$ > $PIDFILE
exec $GNUSTEP_LOCAL_ROOT/Tools/sogod-0.9 >& /var/log/sogo/sogod.log
startport=`defaults read sogod-0.9 WOPort`
if [ "$?" == "0" ]
then
startport=`echo $startport | awk '{print $3}'`
else
startport=20000
fi
let "port=$startport + $1 - 1"
exec $GNUSTEP_LOCAL_ROOT/Tools/sogod-0.9 -WOPort $PORT >& /var/log/sogo/sogod-$PORT.log

View File

@ -0,0 +1,39 @@
#!/bin/sh
# SOGo daemon wrapper
#
# Copyright (C) 2007 Inverse groupe conseil
#
# 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.
PIDFILE=/var/run/sogo/sogod.$1
. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh
echo $$ > $PIDFILE
startport=`defaults read sogod-0.9 WOPort`
if [ "$?" == "0" ]
then
startport=`echo $startport | awk '{print $3}'`
else
startport=20000
fi
let "port=$startport + $1 - 1"
exec $GNUSTEP_LOCAL_ROOT/Tools/sogod-0.9 -WOPort $PORT >& /var/log/sogo/sogod-$PORT.log

View File

@ -1,19 +0,0 @@
#!/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
$GNUSTEP_SYSTEM_ROOT/Tools/$PROGRAM >& /var/log/sogo/sogod.log &
newpid=`pgrep -u $USER $PROGRAM | awk '{ print $1 }'`
echo $newpid > $PIDFILE