Changeset 10829 in hybrid for branches/releng-9.0
- Timestamp:
- May 13, 2012, 2:08:23 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-9.0/nanobsd/files/tools/check-inet-alive
r10720 r10829 11 11 # XXX: For effiently reasons this should be combined with the nagios check_inet check 12 12 # 13 # Rick van der Zwet < info@rickvanderzwet.nl>13 # Rick van der Zwet <rick@wirelessleiden.nl> 14 14 # 15 15 … … 21 21 # Check if we need to check inet at all 22 22 . /etc/rc.subr 23 23 24 load_rc_config "lvrouted" 24 25 load_rc_config "tinyproxy" 26 25 27 : ${lvouted_enable="NO"} 26 28 : ${tinyproxy_enable="NO"} … … 28 30 : ${service_proxy="NO"} 29 31 30 control_lvrouted= "yes"31 control_tinyproxy= "yes"32 (( checkyesno service_ileiden || checkyesno service_proxy ) && checkyesno lvouted_enable ) || control_lvrouted="no" 33 (( checkyesno service_ileiden || checkyesno service_proxy ) && checkyesno tinyproxy_enable ) || control_tinyproxy="no" 32 control_lvrouted=false 33 control_tinyproxy=false 34 checkyesno service_proxy_ileiden && checkyesno lvouted_enable control_lvrouted=true 35 checkyesno service_proxy_normal && checkyesno tinyproxy_enable || control_tinyproxy=false 34 36 35 37 36 service lvrouted onestatus > /dev/null && LVROUTED_STATUS="running" || LVROUTED_STATUS="stopped" 37 service tinyproxy onestatus > /dev/null && TINYPROXY_STATUS="running" || TINYPROXY_STATUS="stopped" 38 # Get current state of the daemons 39 lvouted_status="stopped" 40 tinyproxy_status="stopped" 41 service lvrouted onestatus > /dev/null && lvouted_status="running" 42 service tinyproxy onestatus > /dev/null && tinyproxy_status="running" 38 43 39 44 check_http() { … … 41 46 } 42 47 43 # Get connection stats for internet 44 INET_STATUS=up && check_http http://proxy-test.wirelessleiden.nl || check_http http://ams-ix.net || INET_STATUS=down 45 # Connections statistics for proxy 48 # Get connection stats for internet direct and via proxy 49 inet_status=up 50 proxy_status=up 51 check_http http://proxy-test.wirelessleiden.nl || check_http http://ams-ix.net || inet_status=down 46 52 export HTTP_PROXY=${HTTP_PROXY-:http://proxy.wleiden.net:3128} 47 PROXY_STATUS=up && check_http http://tinyproxy.stats || check_http http://ams-ix.net || PROXY_STATUS=down53 check_http http://tinyproxy.stats || check_http http://ams-ix.net || proxy_status=down 48 54 49 55 # Log Network Status 50 56 cat <<EOF > /tmp/network.status 51 internet=$ INET_STATUS52 proxy=$ PROXY_STATUS57 internet=$inet_status 58 proxy=$proxy_status 53 59 EOF 54 60 55 61 # Control connections 56 if checkyesnocontrol_lvrouted; then57 if [ $ LVROUTED_STATUS = "stopped" ] && [ $INET_STATUS= "up" ]; then62 if $control_lvrouted; then 63 if [ $lvrouted_status = "stopped" ] && [ $inet_status = "up" ]; then 58 64 service lvrouted start | logit 59 elif [ $ LVROUTED_STATUS = "running" ] && [ $INET_STATUS= "down" ]; then65 elif [ $lvrouted_status = "running" ] && [ $inet_status = "down" ]; then 60 66 service lvrouted stop | logit 61 67 fi 62 68 fi 63 69 64 if checkyesnocontrol_tinyproxy; then65 if [ $ TINYPROXY_STATUS_STATUS = "stopped" ] && [ $INET_STATUS= "up" ]; then70 if $control_tinyproxy; then 71 if [ $tinyproxy_status = "stopped" ] && [ $inet_status = "up" ]; then 66 72 service tinyproxy start | logit 67 elif [ $ TINYPROXY_STATUS = "running" ] && [ $INET_STATUS= "down" ]; then73 elif [ $tinyproxy_status = "running" ] && [ $inet_status = "down" ]; then 68 74 service tinyproxy stop | logit 69 75 fi
Note:
See TracChangeset
for help on using the changeset viewer.