This is for arch Linux but the simple technique can be used to sort any other mirrors.
First create a backup of the original /etc/pacman.d/mirrorlist as /etc/pacman.d/mirrorlist.orig
Then create the following simple script:
#!/bin/bash
awk -F'/' '{print $3}' /etc/pacman.d/mirrorlist.orig | grep -v '^$' | while read line;
do
HEAD $line &>/dev/null && grep -B1 $line /etc/pacman.d/mirrorlist.orig&
done > /etc/pacman.d/mirrorlist
Running this script will create the sorted list of mirrors in /etc/pacman.d/mirrorlist based on how fast the mirror respond to the HTTP request.
Sunday, August 27, 2017
Monday, July 24, 2017
A simple thread manager for a bash/shell scripts
A simple thread manager for a bash/shell scripts. Place your command in place of 'sleep $((30/i))'
TREG=/tmp/treg
:> $TREG
function add_t(){
echo Starting $1
echo $1 >> $TREG
}
function rem_t(){
echo Done $1
sed -i /^$1$/d $TREG
}
function clean(){
:> $TREG
exit 1
}
trap "clean" SIGINT SIGTERM
for i in 1 2 3
do
(add_t thread$i;sleep $((30/i));rem_t thread$i)&
done
while true
do
if [[ -s $TREG ]]
then
echo Running:
cat $TREG
else
echo All Done.
break
fi
sleep 2
done
TREG=/tmp/treg
:> $TREG
function add_t(){
echo Starting $1
echo $1 >> $TREG
}
function rem_t(){
echo Done $1
sed -i /^$1$/d $TREG
}
function clean(){
:> $TREG
exit 1
}
trap "clean" SIGINT SIGTERM
for i in 1 2 3
do
(add_t thread$i;sleep $((30/i));rem_t thread$i)&
done
while true
do
if [[ -s $TREG ]]
then
echo Running:
cat $TREG
else
echo All Done.
break
fi
sleep 2
done
Subscribe to:
Posts (Atom)
Intel Corporation XMM7360 LTE Advanced Modem in ArchLinux
The required packages are available in ArchLinux User Repository (AUR) so it will be easier if you can use an AUR helper package like yay . ...
-
The required packages are available in ArchLinux User Repository (AUR) so it will be easier if you can use an AUR helper package like yay . ...
-
Kannel is a gateway for connecting WAP (Wireless Application Protocol) phones to the Internet. It also works as an SMS gateway, for providin...