instead of changing something 3 times.. change it once
This commit is contained in:
parent
2ad7647360
commit
9997e29c29
1 changed files with 12 additions and 9 deletions
|
@ -9,6 +9,10 @@
|
|||
mirrorlist1="http://localhost:18081/metalink?repo=rawhide&arch=x86_64"
|
||||
mirrorlist2="http://localhost:18082/metalink?repo=rawhide&arch=x86_64"
|
||||
|
||||
TIME_DRAIN=30
|
||||
TIME_RESTART=5
|
||||
TIME_DISABLE=5
|
||||
|
||||
##
|
||||
|
||||
# Initial expected state is mirrorlist1 running, mirrorlist2 running and new pkl
|
||||
|
@ -37,7 +41,7 @@ fi
|
|||
|
||||
systemctl start mirrorlist2
|
||||
|
||||
sleep 5
|
||||
sleep ${TIME_RESTART}
|
||||
curl -q -H mirrors.fedoraproject.org ${mirrorlist2} -s -f --retry 50 --retry-delay 10 --retry-connrefused --retry-max-time 180 | grep "sha512" >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
echo "ERROR: mirrorlist2 did not start correctly"
|
||||
|
@ -47,14 +51,14 @@ fi
|
|||
# Drain mirrorlist1. This is safe since we assured that local2 is serving
|
||||
echo "enable server mirror-lists-backend/mirrorlist-local2" | nc -U /var/run/haproxy-admin >& /dev/null
|
||||
echo "set server mirror-lists-backend/mirrorlist-local1 state drain" | nc -U /var/run/haproxy-admin >& /dev/null
|
||||
sleep 10
|
||||
sleep ${TIME_DRAIN}
|
||||
echo "disable server mirror-lists-backend/mirrorlist-local1" | nc -U /var/run/haproxy-admin >& /dev/null
|
||||
sleep 5
|
||||
sleep ${TIME_DISABLE}
|
||||
|
||||
# restart mirrorlist1 (new pkl and make sure it's processing ok)
|
||||
systemctl restart mirrorlist1
|
||||
|
||||
sleep 5
|
||||
sleep ${TIME_RESTART}
|
||||
curl -q -H mirrors.fedoraproject.org ${mirrorlist1} -s -f --retry 50 --retry-delay 10 --retry-connrefused --retry-max-time 180 | grep "sha512" >/dev/null
|
||||
if [ $? != 0 ]; then
|
||||
echo "ERROR: mirrorlist1 did not restart correctly"
|
||||
|
@ -62,23 +66,22 @@ if [ $? != 0 ]; then
|
|||
fi
|
||||
|
||||
# New mirrorlist seems to be working, put it back into service
|
||||
sleep 5
|
||||
echo "enable server mirror-lists-backend/mirrorlist-local1" | nc -U /var/run/haproxy-admin >& /dev/null
|
||||
sleep 5
|
||||
sleep ${TIME_RESTART}
|
||||
|
||||
# copy new pkl to mirrorlist2
|
||||
cp -a /srv/mirrorlist/data/mirrorlist1/* /srv/mirrorlist/data/mirrorlist2/
|
||||
|
||||
# Drain mirrorlist2
|
||||
echo "set server mirror-lists-backend/mirrorlist-local2 state drain" | nc -U /var/run/haproxy-admin >& /dev/null
|
||||
sleep 10
|
||||
sleep ${TIME_DRAIN}
|
||||
echo "disable server mirror-lists-backend/mirrorlist-local2" | nc -U /var/run/haproxy-admin >& /dev/null
|
||||
sleep 5
|
||||
sleep ${TIME_DISABLE}
|
||||
|
||||
# restart mirrorlist2
|
||||
systemctl restart mirrorlist2
|
||||
|
||||
sleep 5
|
||||
sleep ${TIME_RESTART}
|
||||
curl -q -H mirrors.fedoraproject.org ${mirrorlist2} -o/dev/null -s -f --retry 50 --retry-delay 10 --retry-connrefused --retry-max-time 180
|
||||
if [ $? != 0 ]; then
|
||||
echo "ERROR: mirrorlist2 did not restart correctly"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue