4 # Required-Start: $network $remote_fs $syslog
5 # Required-Stop: $network $remote_fs $syslog
6 # Default-Start: 2 3 4 5
8 # Short-Description: git-daemon service
9 # Description: git-daemon is a simple server for git repositories,
10 # ideally suited for read-only updates, i.e. pulling from
11 # git repositories through the network.
14 # PATH should only include /usr/* if it runs after the mountnfs.sh script
15 PATH
=/sbin
:/usr
/sbin
:/bin
:/usr
/bin
:/usr
/lib
/git-core
16 DESC
="git-daemon service"
18 DAEMON
=/usr
/lib
/git-core
/$NAME
19 PIDFILE
=/var
/run
/$NAME.pid
20 SCRIPTNAME
=/etc
/init.d
/$NAME
22 # Exit if the package is not installed
23 [ -e /usr
/share
/git-core
/sysvinit
/sentinel
] ||
exit 0
25 # Read configuration variable file if it is present
26 [ -r /etc
/default
/$NAME ] && .
/etc
/default
/$NAME
28 GIT_DAEMON_USER
=${GIT_DAEMON_USER:-gitdaemon}
29 GIT_DAEMON_BASE_PATH
=${GIT_DAEMON_BASE_PATH:-/var/lib}
30 GIT_DAEMON_DIRECTORY
=${GIT_DAEMON_DIRECTORY:-/var/lib/git}
32 DAEMON_ARGS
="--user=$GIT_DAEMON_USER --pid-file=$PIDFILE --detach"
33 DAEMON_ARGS
="$DAEMON_ARGS --reuseaddr --verbose $GIT_DAEMON_OPTIONS"
34 DAEMON_ARGS
="$DAEMON_ARGS --base-path=$GIT_DAEMON_BASE_PATH $GIT_DAEMON_DIRECTORY"
36 # Load the VERBOSE setting and other rcS variables
39 # Define LSB log_* functions.
40 # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
41 .
/lib
/lsb
/init-functions
44 # Function that starts the daemon/service
49 # 0 if daemon has been started
50 # 1 if daemon was already running
51 # 2 if daemon could not be started
52 start-stop-daemon
--start --quiet --pidfile $PIDFILE --exec $DAEMON --test > /dev
/null \
54 start-stop-daemon
--start --quiet --pidfile $PIDFILE --exec $DAEMON -- \
60 # Function that stops the daemon/service
65 # 0 if daemon has been stopped
66 # 1 if daemon was already stopped
67 # 2 if daemon could not be stopped
68 # other if a failure occurred
69 start-stop-daemon
--stop --quiet --retry=TERM
/30/KILL
/5 --pidfile $PIDFILE --name $NAME
71 [ "$RETVAL" = 2 ] && return 2
72 # Many daemons don't delete their pidfiles when they exit.
79 if [ $GIT_DAEMON_ENABLE = true
]; then
80 [ "$VERBOSE" != no
] && log_daemon_msg
"Starting $DESC " "$NAME"
82 [ "$VERBOSE" != no
] && log_warning_msg
"$NAME not enabled in /etc/default/$NAME, not starting..."
88 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
89 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
93 [ "$VERBOSE" != no
] && log_daemon_msg
"Stopping $DESC" "$NAME"
96 0|
1) [ "$VERBOSE" != no
] && log_end_msg
0 ;;
97 2) [ "$VERBOSE" != no
] && log_end_msg
1 ;;
101 status_of_proc
"$DAEMON" "$NAME" && exit 0 ||
exit $?
103 restart|force-reload
)
104 if [ $GIT_DAEMON_ENABLE != true
]; then
105 [ "$VERBOSE" != no
] && log_warning_msg
"$NAME not enabled in /etc/default/$NAME, stopping..."
115 log_daemon_msg
"Restarting $DESC" "$NAME"
122 1) log_end_msg
1 ;; # Old process is still running
123 *) log_end_msg
1 ;; # Failed to start
133 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2