mirror of https://framagit.org/kyodev/kyopages.git
1.3.0
This commit is contained in:
parent
bee379a445
commit
d90a0b9419
|
@ -1,7 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
version=1.2.0
|
version=1.3.0
|
||||||
date="27/08/2017"
|
date="28/08/2017"
|
||||||
projet="simpledeb"
|
projet="simpledeb"
|
||||||
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
contact="IRC freenode ##sdeb ou https://framagit.org/kyodev/kyopages/issues/"
|
||||||
script="getIp"
|
script="getIp"
|
||||||
|
@ -118,8 +118,9 @@ f__user(){ # v21/08/2017-4
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# test wget, $1 url à tester affiche url testée & entêtes http, sortie script sur erreur
|
# test wget, $1 url à tester, sortie script, sur erreur ou retour à la normale
|
||||||
f__wget_test(){ #v25/08/2017
|
# si $2=print affiche url testée & entêtes http & location (si présente) et sortie normale fonction
|
||||||
|
f__wget_test(){ #v28/08/2017
|
||||||
local file_test_wget="/tmp/testWget-$RANDOM"
|
local file_test_wget="/tmp/testWget-$RANDOM"
|
||||||
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget" || local retourWget="$?"
|
wget -Sq --tries=1 --timeout=10 --user-agent="$user_agent" --spider --save-headers "$1" &>"$file_test_wget" || local retourWget="$?"
|
||||||
[ "$retourWget" == 1 ] && retourWget="code erreur générique"
|
[ "$retourWget" == 1 ] && retourWget="code erreur générique"
|
||||||
|
@ -130,10 +131,23 @@ f__wget_test(){ #v25/08/2017
|
||||||
[ "$retourWget" == 6 ] && retourWget="défaut authentification"
|
[ "$retourWget" == 6 ] && retourWget="défaut authentification"
|
||||||
[ "$retourWget" == 7 ] && retourWget="erreur de protocole"
|
[ "$retourWget" == 7 ] && retourWget="erreur de protocole"
|
||||||
[ "$retourWget" == 8 ] && retourWget="réponse serveur en erreur"
|
[ "$retourWget" == 8 ] && retourWget="réponse serveur en erreur"
|
||||||
retourHttp="$(grep -i 'HTTP/' "$file_test_wget" | tr -d '\n' | xargs)"
|
local retourHttp="$(grep -i 'HTTP/' "$file_test_wget" | tr -d '\n' | xargs)"
|
||||||
f__error "erreur wget: $retourWget" "url: $1" "$retourHttp" \
|
local location="$(grep -i 'location' $file_test_wget | xargs)"
|
||||||
"Erreur wget" "si persistance, contacter $projet $contact en indiquant les messages précédents"
|
if [ "$2" == "print" ] && [ -z "$retourWget" ]; then
|
||||||
|
echo -e "\n$1"
|
||||||
|
echo "$GREEN$retourHttp$COLOR"
|
||||||
|
[ "$location" ] && echo "$YELLOW$location"
|
||||||
|
echo "$COLOR"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
if [ "$retourWget" ]; then
|
||||||
|
rm "$file_test_wget"
|
||||||
|
f__error "erreur wget, $retourWget" "url: $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
|
||||||
rm "$file_test_wget"
|
rm "$file_test_wget"
|
||||||
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fgi_help(){
|
fgi_help(){
|
||||||
|
@ -262,7 +276,7 @@ fgi_ip_public(){ # $1=IPv4|IPv6, assigne $ip_public # v18/08/2017
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# inscription dans tache upgrade en anacron hebdomadaire, via cron horaire
|
# inscription dans tache upgrade en anacron hebdomadaire, via cron horaire, $1=upgrade|install|remove
|
||||||
fscript_cronAnacron(){ # v27/08/2017
|
fscript_cronAnacron(){ # v27/08/2017
|
||||||
[ "$(type -t fscript_cronAnacron_special)" ] && fscript_cronAnacron_special # test, si fonction spécifique, appel
|
[ "$(type -t fscript_cronAnacron_special)" ] && fscript_cronAnacron_special # test, si fonction spécifique, appel
|
||||||
local dirAnacron="/home/$user_/.config/anacron"
|
local dirAnacron="/home/$user_/.config/anacron"
|
||||||
|
@ -377,7 +391,7 @@ PATH='/usr/sbin:/usr/bin:/sbin:/bin' ; IFS=' '; TERM=xterm
|
||||||
export PATH TERM
|
export PATH TERM
|
||||||
f__affichage
|
f__affichage
|
||||||
fileLogs="/var/log/sdeb_$script.log"
|
fileLogs="/var/log/sdeb_$script.log"
|
||||||
fileDev="fileDev"
|
fileDev="/opt/bin/fileDev"
|
||||||
f__requis "gawk wget ip>iproute2" # requis pour fonctionnement programme
|
f__requis "gawk wget ip>iproute2" # requis pour fonctionnement programme
|
||||||
|
|
||||||
options="$@"
|
options="$@"
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
# changelog getIp
|
# changelog getIp
|
||||||
|
|
||||||
|
|
||||||
|
## 1.3.0 28/08/2017
|
||||||
|
|
||||||
|
* fix bug: localisation fileDev
|
||||||
|
* révision f__wget_test
|
||||||
|
|
||||||
## 1.2.0 27/08/2017
|
## 1.2.0 27/08/2017
|
||||||
|
|
||||||
* fix bug upgrade
|
* fix bug upgrade
|
||||||
|
|
Loading…
Reference in New Issue