Skip to content

Instantly share code, notes, and snippets.

@masasdani
Created March 20, 2012 17:09
Show Gist options
  • Save masasdani/2138275 to your computer and use it in GitHub Desktop.
Save masasdani/2138275 to your computer and use it in GitHub Desktop.
script git daemon untuk mengaktifkan protokol git
#copy file git-daemon dibawah ke /etc/init.d/
$ sudo cp git-daemon /etc/init.d/
$ sudo chmod +x /etc/init.d/git-daemon
$ sudo update-rc.d git-daemon defaults
#menyalakan service
sudo service git-daemon start
#service lain
sudo service git-daemon stop
sudo service git-daemon restart
sudo service git-daemon force-reload
# Taken from here: http://pastie.org/227647
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment