aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gitmirror/templates/on-the-pull.init
blob: 9073508eb8e6a28f950dcc26fb11df5c964f891f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /bin/bash
#
### BEGIN INIT INFO
# Provides: on-the-pull
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Short-Description: Keep git mirrors up-to-date via external triggers
# Description: Keep git mirrors up-to-date via external triggers
### END INIT INFO

# Source function library.
. /etc/init.d/functions

pidfile=/var/run/on-the-pull/on-the-pull.pid
prog=/usr/local/bin/on-the-pull
args="--pid-file=$pidfile --user=git --cmd=/usr/local/bin/gitmirror-sync-metadata git://git.mageia.org/ /git"


start() {
	gprintf "Starting On-The-Pull Git Mirror Daemon: "
	daemon --check on-the-pull --pidfile $pidfile $prog $args >/var/log/on-the-pull.log 2>&1
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/on-the-pull
	return $RETVAL
}

stop() {
	gprintf "Stopping On-The-Pull Git Mirror Daemon: "
	killproc -p $pidfile on-the-pull
	rm -f /var/lock/subsys/on-the-pull
}

restart() {
	stop
	start
}

case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	status)
		status on-the-pull $pidfile
		;;
	restart|reload)
		restart
		;;
	condrestart)
			[ -f /var/lock/subsys/on-the-pull ] && restart || :
			;;
	*)
		gprintf "Usage: %s {start|stop|status|restart|condrestart}\n" "$(basename $0)"
		exit 1
esac

exit 0