blob: b85903d9a41189a4adeba3cb849a07c5a8d77733 (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
#!/bin/bash
# alfplayer
# 2014-06-12
#
# Test Parabola HTTP(S) and rsync mirror speeds.
mail_to="your@mail.com"
script_filename="$(basename "$0")"
log_dir="/var/log/${script_filename}"
if [[ ! -d ${log_dir} ]] ; then
mkdir "${log_dir}"
fi
echo "=> ${script_filename} started. Start time: $(date -u --rfc-3339=seconds)" >> "${log_dir}/${script_filename}"
# Locking and send email on exit
exit_trap() {
if [[ ${mail_to} ]] ; then
echo "=> Sending output to ${mail_to}"
mail -s "[$(hostname)] ${script_filename}" "${mail_to}" < <(tail -n 1 /var/log/"${script_filename}"/*)
rm -rf "$lockdir"
fi
}
lockdir="/tmp/${script_filename}.lock"
if mkdir "$lockdir" ; then
# Remove lockdir when the script finishes, or when it receives a signal
trap exit_trap 0 # remove directory when script finishes
# Optionally create temporary files in this directory, because
# they will be removed automatically:
tmpfile="$lockdir/filelist"
else
echo >&2 "cannot acquire lock, giving up on $lockdir"
exit 0
fi
test() {
echo -n "$(date -u --rfc-3339=seconds) " >> "${log_dir}/$repo"
filename="$(wget --no-check-certificate -q ${url}/community/os/x86_64/community.db -O - | tar xzO | grep '^vtk-.*pkg.tar.*$')"
wget --no-check-certificate -O /dev/null ${url}/community/os/x86_64/"${filename}" 2>&1 | sed -n -e 's|^.*(\([0-9.]\+ [KM]B/s\)).*$|\1|p' >> "${log_dir}/$repo"
}
# repo.parabola.nu
repo=repo
url='http://repo.parabola.nu'
test
# alfplayer.com
repo=alfplayer
url='http://alfplayer.com/parabola'
test
# yandex.ru
repo=yandex
url='http://mirror.yandex.ru/mirrors/parabola'
test
# https://parabola.goodgnus.com.ar/
repo=goodgnus
url='https://parabola.goodgnus.com.ar'
test
# http://parabola.leth.cc/
repo=leth
url='http://parabola.leth.cc'
test
# Server = http://mirror.parlementum.net/$repo/os/$arch
repo=parlementum
url='http://mirror.parlementum.net'
test
# IPv6 only, https://parabola.fryxell.info
#repo=fryxell
#url='https://parabola.fryxell.info'
#test
# custom file
#repo=""
#url=""
#echo -n "$(date -u --rfc-3339=seconds) " >> "${log_dir}/$repo"
#wget --no-check-certificate -O /dev/null "$url" 2>&1 | sed -n -e 's|^.*(\([0-9.]\+ [KM]B/s\)).*$|\1|p' >> "${log_dir}/$repo"
echo "Rsync test"
echo "Using amsn package (around 11 MB)"
test_rsync() {
rm -f /tmp/"${script_filename}"-test.db
rsync -L --no-motd ${SERVER}/community/os/x86_64/community.db /tmp/"${script_filename}"-test.db
filename="$(tar xzOf /tmp/${script_filename}-test.db | grep '^amsn-.*pkg.tar.*$')"
rsync -Lv --no-motd ${SERVER}/community/os/x86_64/"${filename}" /tmp/"${script_filename}"-testfile | \
grep -o '[0-9,.]* bytes/sec' >> "${log_dir}/$repo"
rm -f /tmp/"${script_filename}"-testfile
}
repo=rsync_alfplayer
SERVER="rsync://alfplayer.com:873/repos/parabola"
test_rsync
repo=rsync_repo.parabola.nu
SERVER="rsync://repo.parabola.nu:875/repos"
test_rsync
repo=rsync_yandex
SERVER="rsync://mirror.yandex.ru/mirrors/parabola"
test_rsync
repo=rsync_archlinux_unicamp
SERVER="rsync://rsync.las.ic.unicamp.br/pub/archlinux"
test_rsync
echo "=> ${script_filename} finished successfully. Finish time: $(date -u --rfc-3339=seconds)" >> "${log_dir}/${script_filename}"
|