# vim: ft=sh dir=$1 function nginx () { nc -zw2 127.0.0.1 80 || echo "injoignable sur port 80 local" nc -zw2 sebmarque.hd.free.fr 80 || echo "injoignable sur port 80 distant" nc -zw2 sebmarque.hd.free.fr 443 || echo "injoignable sur port 443 distant" } function searx () { nc -zw2 127.0.0.1 8888 || echo "injoignable sur port 8888" } function gitprep () { nc -zw2 127.0.0.1 10020 || echo "injoignable sur port 10020" } function cherrymusic () { nc -zw2 127.0.0.1 8080 || echo "injoignable sur port 8080" } function webapps () { local webapps_conf="$dir/${HOSTNAME}.webapps.conf" if test -r $webapps_conf; then local useragent= local host= local proto= local webapps=() local no_access=() eval "$(< $webapps_conf)" test -z "$useragent" && echo "manque user-agent" && return test -z "$host" && echo "manque hôte" && return test -z "$proto" && echo "manque protocole" && return test $(( ${#webapps[@]} % 3 )) -ne 0 && echo "mauvais nombre de paramètres de tests" && return for ((i=0; i<${#webapps[@]}; i+=3)); do http_response=$(curl --silent --max-time 2 --user-agent "$useragent" --output /dev/null --write-out "%{response_code}" $proto://$host/${webapps[i]}) test $http_response -ne ${webapps[i+2]} && no_access[${#no_access[@]}]="${webapps[i+1]} ($http_response)" done if test ${#no_access[@]} -ne 0; then echo "réponse incorrecte: ${no_access[@]}" fi else echo "pas de conf! ($webapps_conf)" fi } function core_temp () { local min=60 local level=("warning" "severe" "danger!") local step=$(( $( $((min + step * 10))°" fi } function core_alim () { eval $(/opt/vc/bin/vcgencmd measure_volts core) test $volt == "1.2000V" || echo "$volt" } function load_avg () { local procs=4 local load=($(