Hi Georges,
Here is a more conventional init script that I use on ubuntu to start a set of gitit servers for different wikis that are proxied through Apache. It's a slightly modified version of the script posted in the discussion around issue
55, and assumes the wikis are in /var/wikis.
Hope that helps,
John Noll
/etc/init.d/gitit:
------- cut here ------
#! /bin/sh
#
# If this isn't starting, try removing --background to see gitit's error output.
# Note also that the PATH here includes /usr/local/bin, which you may wish to
# remove.
### BEGIN INIT INFO
# Provides: gitit
# Default-Start: 2 3 4 5
# Default-Stop: 1
# Short-Description: VCS-backed wiki engine
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Description: VCS-backed wiki engine
### END INIT INFO
# PATH should only include /usr/* if it runs after the mountnfs.sh script
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin
DESC=git\-backed\ wiki\ engine
NAME=gitit
DAEMON=/usr/local/bin/gitit
BASENAME=gitit
DAEMON_ARGS=\-f\
PIDFILE=
SCRIPTNAME=/etc/init.d/$NAME
USER=www-data
WIKI_DIR=/var/wikis
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 5
# Load the VERBOSE setting and other rcS variables
. /lib/init/vars.sh
# Define LSB log_* functions.
# Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
. /lib/lsb/init-functions
#
# Function that starts the daemon/service
#
do_start()
{
count=1
for f in ${WIKI_DIR}/*/*gitit.config ; do
WIKI_WD=`dirname $f`
WIKI_NAME=`basename ${WIKI_WD}`
CONFIG=$f
PIDFILE=/var/run/${NAME}.${WIKI_NAME}.pid
echo starting ${WIKI_NAME} ${f}
start-stop-daemon --start --background --oknodo --quiet --make-pidfile --pidfile ${PIDFILE} --exec $DAEMON --user $USER --chuid $USER --chdir ${WIKI_WD} -- \
$DAEMON_ARGS ${CONFIG} || return 1
count=$((count+1))
done
}
#
# Function that stops the daemon/service
#
do_stop()
{
log_daemon_msg "Stopping Gitit wikis" gitit
for PIDFILE in `ls /var/run/${NAME}.*.pid` ; do
start-stop-daemon --stop --oknodo --quiet --retry=TERM/30/KILL/5 --pidfile $PIDFILE --name $BASENAME --user $USER --chuid $USER
RETVAL="$?"
rm -f $PIDFILE
done
return "$RETVAL"
}
#
# Function that sends a SIGHUP to the daemon/service
#
do_reload() {
for PIDFILE in `ls /var/run/${NAME}.*.pid` ; do
start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME --user $USER --chuid $USER
done
return 0
}
case "$1" in
start)
log_daemon_msg "Starting $DESC" "$NAME"
do_start
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
log_end_msg $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0)
do_start
log_end_msg "$?"
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
-------------