]>
Commit | Line | Data |
---|---|---|
975e80c2 AG |
1 | #!/bin/sh |
2 | # | |
3 | # git-daemon git-daemon tcp daemon for git | |
4 | # | |
5 | # chkconfig: 345 90 25 | |
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_starting git-daemon | |
7ba2660f | 36 | daemon --fork @libdir@/git-core/git-daemon $DAEMON_OPTS |
975e80c2 AG |
37 | RETVAL=$? |
38 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/git-daemon | |
39 | else | |
40 | msg_already_running git-daemon | |
41 | fi | |
42 | } | |
43 | ||
44 | stop() { | |
45 | if [ -f /var/lock/subsys/git-daemon ]; then | |
46 | # Stop daemons. | |
47 | msg_stopping git-daemon | |
48 | killproc git-daemon | |
49 | rm -f /var/lock/subsys/git-daemon | |
50 | else | |
51 | msg_not_running git-daemon | |
52 | fi | |
53 | } | |
54 | ||
55 | reload() { | |
56 | if [ -f /var/lock/subsys/git-daemon ]; then | |
57 | msg_reloading git-daemon | |
58 | killproc git-daemon -HUP | |
59 | RETVAL=$? | |
60 | else | |
61 | msg_not_running git-daemon | |
62 | RETVAL=7 | |
63 | fi | |
64 | } | |
65 | ||
c8d26d7c JB |
66 | condrestart() { |
67 | if [ -f /var/lock/subsys/git-daemon ]; then | |
68 | stop | |
69 | start | |
70 | else | |
71 | msg_not_running git-daemon | |
72 | RETVAL=$1 | |
73 | fi | |
74 | } | |
75 | ||
975e80c2 AG |
76 | RETVAL=0 |
77 | # See how we were called. | |
78 | case "$1" in | |
79 | start) | |
80 | start | |
81 | ;; | |
82 | stop) | |
83 | stop | |
84 | ;; | |
85 | restart) | |
86 | stop | |
87 | start | |
88 | ;; | |
c8d26d7c JB |
89 | try-restart) |
90 | condrestart 0 | |
975e80c2 | 91 | ;; |
c8d26d7c JB |
92 | reload|force-reload) |
93 | reload | |
975e80c2 AG |
94 | ;; |
95 | status) | |
96 | status git-daemon | |
97 | RETVAL=$? | |
98 | ;; | |
99 | *) | |
c8d26d7c | 100 | msg_usage "$0 {start|stop|restart|try-restart|reload|force-reload|status}" |
975e80c2 AG |
101 | exit 3 |
102 | esac | |
103 | ||
104 | exit $RETVAL |