add git-daemon-gitosis
This commit is contained in:
parent
2b55b431c4
commit
fd38951f91
65
git-daemon-gitosis
Executable file
65
git-daemon-gitosis
Executable file
@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
|
||||
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
|
||||
NAME=git-daemon
|
||||
PIDFILE=/var/run/$NAME.pid
|
||||
DESC="the git daemon"
|
||||
DAEMON=/usr/bin/git
|
||||
DAEMON_OPTS="daemon --base-path=/var/git/git/repositories --verbose --syslog --detach --pid-file=$PIDFILE --user=git --group=nogroup --export-all"
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
[ -r /etc/default/git-daemon ] && . /etc/default/git-daemon
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
start_git() {
|
||||
start-stop-daemon --start --quiet --pidfile $PIDFILE \
|
||||
--startas $DAEMON -- $DAEMON_OPTS
|
||||
}
|
||||
|
||||
stop_git() {
|
||||
start-stop-daemon --stop --quiet --pidfile $PIDFILE
|
||||
rm -f $PIDFILE
|
||||
}
|
||||
|
||||
status_git() {
|
||||
start-stop-daemon --stop --test --quiet --pidfile $PIDFILE >/dev/null 2>&1
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_begin_msg "Starting $DESC"
|
||||
start_git
|
||||
log_end_msg 0
|
||||
;;
|
||||
stop)
|
||||
log_begin_msg "Stopping $DESC"
|
||||
stop_git
|
||||
log_end_msg 0
|
||||
;;
|
||||
status)
|
||||
log_begin_msg "Testing $DESC: "
|
||||
if status_git
|
||||
then
|
||||
log_success_msg "Running"
|
||||
exit 0
|
||||
else
|
||||
log_failure_msg "Not running"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
restart|force-reload)
|
||||
log_begin_msg "Restarting $DESC"
|
||||
stop_git
|
||||
sleep 1
|
||||
start_git
|
||||
log_end_msg 0
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
Loading…
x
Reference in New Issue
Block a user