1 |
#! /bin/bash |
2 |
# |
3 |
### BEGIN INIT INFO |
4 |
# Provides: on-the-pull |
5 |
# Required-Start: $network |
6 |
# Required-Stop: $network |
7 |
# Default-Start: 2 3 4 5 |
8 |
# Short-Description: Keep git mirrors up-to-date via external triggers |
9 |
# Description: Keep git mirrors up-to-date via external triggers |
10 |
### END INIT INFO |
11 |
|
12 |
# Source function library. |
13 |
. /etc/init.d/functions |
14 |
|
15 |
pidfile=/var/run/on-the-pull/on-the-pull.pid |
16 |
prog=/usr/local/bin/on-the-pull |
17 |
args="--pid-file=$pidfile --user=git --cmd=/usr/local/bin/gitmirror-sync-metadata git://git.mageia.org/ /git" |
18 |
|
19 |
|
20 |
start() { |
21 |
gprintf "Starting On-The-Pull Git Mirror Daemon: " |
22 |
daemon --check on-the-pull --pidfile $pidfile $prog $args >/var/log/on-the-pull.log 2>&1 |
23 |
RETVAL=$? |
24 |
echo |
25 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/on-the-pull |
26 |
return $RETVAL |
27 |
} |
28 |
|
29 |
stop() { |
30 |
gprintf "Stopping On-The-Pull Git Mirror Daemon: " |
31 |
killproc -p $pidfile on-the-pull |
32 |
rm -f /var/lock/subsys/on-the-pull |
33 |
} |
34 |
|
35 |
restart() { |
36 |
stop |
37 |
start |
38 |
} |
39 |
|
40 |
case "$1" in |
41 |
start) |
42 |
start |
43 |
;; |
44 |
stop) |
45 |
stop |
46 |
;; |
47 |
status) |
48 |
status on-the-pull $pidfile |
49 |
;; |
50 |
restart|reload) |
51 |
restart |
52 |
;; |
53 |
condrestart) |
54 |
[ -f /var/lock/subsys/on-the-pull ] && restart || : |
55 |
;; |
56 |
*) |
57 |
gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$(basename $0)" |
58 |
exit 1 |
59 |
esac |
60 |
|
61 |
exit 0 |