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