Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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/lib/git-core/git-daemon
- DAEMON_OPTS="--base-path=/srv/gitosis/repositories --export-all --verbose --syslog --detach --pid-file=$PIDFILE --user=gitosis --group=nogroup"
- 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
Add Comment
Please, Sign In to add comment