GitHub clone based on Debian Squeeze Gitolite Git Git-Daemon MySQL Nginx and Mongrel Cluster » git_daemon.txt
| 1 |
#!/bin/sh |
|---|---|
| 2 |
### BEGIN INIT INFO |
| 3 |
# Provides: git-daemon |
| 4 |
# Required-Start: $network |
| 5 |
# Required-Stop: $network |
| 6 |
# Default-Start: 2 3 4 5 |
| 7 |
# Default-Stop: 0 1 6 |
| 8 |
# Short-Description: Start/stop git-daemon |
| 9 |
### END INIT INFO |
| 10 |
|
| 11 |
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:\ |
| 12 |
/usr/bin:/usr/lib/git-core |
| 13 |
NAME=git-daemon |
| 14 |
PIDFILE=/var/run/$NAME.pid |
| 15 |
DESC="git daemon" |
| 16 |
DAEMON=/usr/lib/git-core/git-daemon |
| 17 |
DAEMON_OPTS="--base-path=/opt/gitolite/repositories --verbose \ |
| 18 |
--syslog --detach --pid-file=$PIDFILE --user=git \ |
| 19 |
--group=nogroup" |
| 20 |
|
| 21 |
test -x $DAEMON || exit 0 |
| 22 |
|
| 23 |
[ -r /etc/default/git-daemon ] && . /etc/default/git-daemon |
| 24 |
|
| 25 |
. /lib/lsb/init-functions |
| 26 |
|
| 27 |
start_git() {
|
| 28 |
start-stop-daemon --start --quiet --pidfile $PIDFILE \ |
| 29 |
--startas $DAEMON -- $DAEMON_OPTS |
| 30 |
} |
| 31 |
|
| 32 |
stop_git() {
|
| 33 |
start-stop-daemon --stop --quiet --pidfile $PIDFILE |
| 34 |
rm -f $PIDFILE |
| 35 |
} |
| 36 |
|
| 37 |
status_git() {
|
| 38 |
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE >/dev/null 2>&1 |
| 39 |
} |
| 40 |
|
| 41 |
case "$1" in |
| 42 |
start) |
| 43 |
log_begin_msg "Starting $DESC" |
| 44 |
start_git |
| 45 |
log_end_msg 0 |
| 46 |
;; |
| 47 |
stop) |
| 48 |
log_begin_msg "Stopping $DESC" |
| 49 |
stop_git |
| 50 |
log_end_msg 0 |
| 51 |
;; |
| 52 |
status) |
| 53 |
log_begin_msg "Testing $DESC: " |
| 54 |
if status_git |
| 55 |
then |
| 56 |
log_success_msg "Running" |
| 57 |
exit 0 |
| 58 |
else |
| 59 |
log_failure_msg "Not running" |
| 60 |
exit 1 |
| 61 |
fi |
| 62 |
;; |
| 63 |
restart|force-reload) |
| 64 |
log_begin_msg "Restarting $DESC" |
| 65 |
stop_git |
| 66 |
sleep 1 |
| 67 |
start_git |
| 68 |
log_end_msg 0 |
| 69 |
;; |
| 70 |
*) |
| 71 |
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
|
| 72 |
exit 1 |
| 73 |
;; |
| 74 |
esac |
| 75 |
|
| 76 |
exit 0 |
- « Previous
- 1
- 2
- 3
- Next »