adding loop to make mass updates more comfortable

This commit is contained in:
2015-05-07 08:56:48 +03:00
parent 23f5b0e4b5
commit 63625f98c0
+14 -12
View File
@@ -5,28 +5,30 @@ cd "$(dirname "$(readlink -f "$0")")"
if [ ! -e config.cfg ]; then echo "Missing config.cfg file. Edit and rename config.cfg.sample"; exit 1; fi
source config.cfg
if [ "$1" == "" ]; then
number="98"
while [ $number != "99" ]
do
if [ "$1" == "" ]; then
for ((i = 0; i < ${#NAME[*]}; i++)); do
echo "$i. ${NAME[$i]} ${HOST[$i]}"
done
echo "99. Cancel update"
echo "99. Cancel."
read -p "Which host's original index site should be updated? " number
else
else
number="$1"
fi
fi
if [ "$number" == 99 ]; then
if [ "$number" == 99 ]; then
echo "Update canceled."
exit 1
fi
fi
CURNAME=${NAME[$number]}
CURHOST=${HOST[$number]}
CURNAME=${NAME[$number]}
CURHOST=${HOST[$number]}
if [ -e sites/"$CURHOST".orig ]; then
if [ -e sites/"$CURHOST".orig ]; then
rm sites/"$CURHOST".orig
fi
wget -q -T 5 -t 2 -U $(cat monitor-user-agent.txt) -O sites/"$CURHOST".orig http://"$CURHOST"
fi
wget -q -T 5 -t 2 -U $(cat monitor-user-agent.txt) -O sites/"$CURHOST".orig http://"$CURHOST"