1 |
colin |
3407 |
#! /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 |
colin |
3415 |
args="--pid-file=$pidfile --user=git --cmd=/usr/local/bin/gitmirror-sync-metadata git://git.mageia.org /git" |
18 |
colin |
3407 |
|
19 |
|
|
|
20 |
|
|
start() { |
21 |
|
|
gprintf "Starting On-The-Pull Git Mirror Daemon: " |
22 |
colin |
3415 |
daemon --check on-the-pull --pidfile $pidfile "$prog $args >>/var/log/on-the-pull.log 2>&1" |
23 |
colin |
3407 |
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 |
colin |
3415 |
echo |
33 |
colin |
3409 |
rm -f /var/lock/subsys/on-the-pull |
34 |
colin |
3407 |
} |
35 |
|
|
|
36 |
|
|
restart() { |
37 |
|
|
stop |
38 |
|
|
start |
39 |
|
|
} |
40 |
|
|
|
41 |
|
|
case "$1" in |
42 |
|
|
start) |
43 |
|
|
start |
44 |
|
|
;; |
45 |
|
|
stop) |
46 |
|
|
stop |
47 |
|
|
;; |
48 |
|
|
status) |
49 |
|
|
status on-the-pull $pidfile |
50 |
|
|
;; |
51 |
|
|
restart|reload) |
52 |
|
|
restart |
53 |
|
|
;; |
54 |
|
|
condrestart) |
55 |
|
|
[ -f /var/lock/subsys/on-the-pull ] && restart || : |
56 |
|
|
;; |
57 |
|
|
*) |
58 |
|
|
gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$(basename $0)" |
59 |
|
|
exit 1 |
60 |
|
|
esac |
61 |
|
|
|
62 |
|
|
exit 0 |