blob: b4f54832c250b6a94b87b798607b6730c38f0962 (
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
62
63
|
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Exactly two parameter needed. category and /path/to/logfile"
exit 1
fi
exec >> $2
exec 2>&1
CURDATE=`date +%s`
if [ "${1}" == "fedora" ]; then
CATEGORY="Linux"
elif [ "${1}" == "epel" ]; then
CATEGORY="EPEL"
elif [ "${1}" == "alt" ]; then
CATEGORY="Other"
elif [ "${1}" == "fedora-secondary" ]; then
CATEGORY="Secondary Arches"
elif [ "${1}" == "archive" ]; then
CATEGORY="Archive"
fi
if [ -e /var/run/mirrormanager/umdl-${1} ]; then
. /var/run/mirrormanager/umdl-${1}
else
# 24 hours -> 86400 seconds
let LASTRUN=CURDATE-86400
fi
# FULLFILETIMELIST -> FFTL
FFTL="/srv/pub/${1}/fullfiletimelist-${1}"
FILEDATE=`stat -c %Z ${FFTL} 2> /dev/null`
if [ "$?" -eq "1" ]; then
echo "Error stat() of ${FFTL} failed. This should not happen."
exit 1
fi
if [ "$LASTRUN" -gt "$FILEDATE" ]; then
# no changes on the master mirror
# abort
exit 0
fi
echo -n "${FFTL} has changed since last run. Running umdl for Fedora ${CATEGORY} at "
date
/usr/local/bin/lock-wrapper umdl-${1} "/usr/bin/mm2_update-master-directory-list --category \"Fedora ${CATEGORY}\""
if [ "$?" -eq "0" ]; then
# success! remember the date of this run
echo "LASTRUN=${CURDATE}" > /var/run/mirrormanager/umdl-${1}
echo -n "Finished umdl for Fedora ${CATEGORY} successfully at "
date
exit 0
fi
echo -n "umdl for Fedora ${CATEGORY} returned non-zero. Something failed. Please check umdl.log. "
date
|