This commit is contained in:
kyodev 2017-09-01 22:17:15 +02:00
parent 58e58b5fe6
commit 200b045602
2 changed files with 9 additions and 5 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
version=1.9.0
date="30/08/2017"
version=1.9.1
date="01/09/2017"
projet="simpledeb"
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
script="getInfo"
@ -151,7 +151,7 @@ f__user(){ # v30/08/2017-4
# test wget, $1 url à tester, sortie script, sur erreur ou retour à la normale
# si $2=print affiche url testée & entêtes http & location (si présente) et sortie normale fonction
f__wget_test(){ # v30/08/2017
f__wget_test(){ # v31/08/2017
local file_test_wget retourWget retourHttp location
file_test_wget="/tmp/testWget-$RANDOM"
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget" || retourWget="$?"
@ -166,7 +166,7 @@ f__wget_test(){ # v30/08/2017
retourHttp="$(grep -i 'HTTP/' "$file_test_wget" | tr -d '\n' | xargs)"
location="$(grep -i 'location' $file_test_wget | xargs)"
if [ "$2" == "print" ] && [ -z "$retourWget" ]; then
echo -e "\n$1"
echo -e "\n$BLUE$1"
echo "$GREEN$retourHttp$COLOR"
[ "$location" ] && echo "$YELLOW$location"
echo "$COLOR"
@ -174,7 +174,7 @@ f__wget_test(){ # v30/08/2017
fi
if [ "$retourWget" ]; then
rm "$file_test_wget"
f__error "erreur wget, $retourWget" "url: $1" "$YELLOW$retourHttp" \
f__error "erreur wget, $retourWget" "$1" "$YELLOW$retourHttp" \
"si persistance, contacter $projet $contact en indiquant les messages précédents"
fi
if [ "$(grep -c '200' <<< $retourHttp)" -ne 0 ]; then echo -e "$GREEN\ntout est ok, réessayer\n$COLOR"; fi

View File

@ -4,6 +4,10 @@
* adresses MAC?
## 1.9.1 01/09/2017
* révision mineure f__wget_test
## 1.9.0 30/08/2017
* révision f__requis, f__user, f__wget_test, fscript_cronAnacron