]> git.pld-linux.org Git - packages/git-core.git/blob - git-core.init
package zsh completion
[packages/git-core.git] / git-core.init
1 #!/bin/sh
2 #
3 # git-daemon    git-daemon tcp daemon for git
4 #
5 # chkconfig:    345 90 10
6 #
7 # description:  git-daemon is a simple tcp daemon that serves git repositories
8 #
9 # $Id$
10
11 # Source function library
12 . /etc/rc.d/init.d/functions
13
14 # Get network config
15 . /etc/sysconfig/network
16
17 DAEMON_OPTS="--syslog"
18
19 # Get service config - may override defaults
20 [ -f /etc/sysconfig/git-daemon ] && . /etc/sysconfig/git-daemon
21
22 # Check that networking is up.
23 if is_yes "${NETWORKING}"; then
24         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
25                 msg_network_down "git-daemon"
26                 exit 1
27         fi
28 else
29         exit 0
30 fi
31
32 start() {
33         # Check if the service is already running?
34         if [ -f /var/lock/subsys/git-daemon ]; then
35                 msg_already_running "git-daemon"
36                 return
37         fi
38
39         msg_starting "git-daemon"
40         daemon --fork @libdir@/git-core/git-daemon $DAEMON_OPTS
41         RETVAL=$?
42         [ $RETVAL -eq 0 ] && touch /var/lock/subsys/git-daemon
43 }
44
45 stop() {
46         if [ ! -f /var/lock/subsys/git-daemon ]; then
47                 msg_not_running "git-daemon"
48                 return
49         fi
50
51         # Stop daemons.
52         msg_stopping "git-daemon"
53         killproc git-daemon
54         rm -f /var/lock/subsys/git-daemon
55 }
56
57 reload() {
58         if [ ! -f /var/lock/subsys/git-daemon ]; then
59                 msg_not_running "git-daemon"
60                 RETVAL=7
61                 return
62         fi
63
64         msg_reloading "git-daemon"
65         killproc git-daemon -HUP
66         RETVAL=$?
67 }
68
69 condrestart() {
70         if [ ! -f /var/lock/subsys/git-daemon ]; then
71                 msg_not_running "git-daemon"
72                 RETVAL=$1
73                 return
74         fi
75
76         stop
77         start
78 }
79
80 RETVAL=0
81 # See how we were called.
82 case "$1" in
83   start)
84         start
85         ;;
86   stop)
87         stop
88         ;;
89   restart)
90         stop
91         start
92         ;;
93   try-restart)
94         condrestart 0
95         ;;
96   reload|force-reload)
97         reload
98         ;;
99   status)
100         status git-daemon
101         RETVAL=$?
102         ;;
103   *)
104         msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}"
105         exit 3
106 esac
107
108 exit $RETVAL
This page took 0.042754 seconds and 3 git commands to generate.