SYNOPSYS

When gitolite (see this post) is installed, time to open the gates of knowledge.

PROCEDURE

/etc/init.d/git-daemon

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
 #!/bin/sh
### BEGIN INIT INFO
# Provides:          git-daemon
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Git repo server daemon
### END INIT INFO
# /etc/init.d/git-daemon
#

set -e

. /lib/lsb/init-functions

DAEMON=/usr/lib/git-core/git-daemon
NAME=git-daemon
PATH=/sbin:/bin:/usr/sbin:/usr/bin
PID_FILE="/var/run/git-daemon.pid"
DAEMONOPTS="--detach --syslog --pid-file=$PID_FILE --user=git --base-path=/home/git/repositories --export-all"

test -x $DAEMON || exit 0

case "$1" in
  start)
    echo -n "Starting $NAME server"
    start-stop-daemon --start --background -m --pidfile $PID_FILE --exec $DAEMON -- $DAEMONOPTS
    echo "."
    ;;
  stop)
    echo -n "Stopping $NAME server"
    start-stop-daemon --stop --pidfile $PID_FILE --oknodo --exec $DAEMON
    rm -f $PID_FILE
    echo "."
    ;;
  status)
    status_of_proc -p $PID_FILE $DAEMON $NAME && exit 0 || exit $?
    ;;
  *)
    echo "Usage: /etc/init.d/$NAME {start|stop|status}"
    exit 1
    ;;
esac

exit 0