Changeset 10481 in hybrid for branches/releng-9.0/nanobsd/files/usr/local/sbin
- Timestamp:
- Apr 13, 2012, 6:54:31 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/releng-9.0/nanobsd/files/usr/local/sbin/check-inet-alive
r10469 r10481 9 9 # XXX: Do we need to manage state, like DHCP here? 10 10 # XXX: Check if page output is actually the output expected and not some weird captive portal somewhere. 11 # XXX: For effiently reasons this should be combined with the nagios check_inet check 11 12 # 12 13 # Rick van der Zwet <info@rickvanderzwet.nl> 13 14 # 14 15 # Check if we need to check inet at all16 . /etc/rc.subr17 load_rc_config "lvrouted"18 : ${lvouted_enable="NO"}19 : ${service_ileiden="NO"}20 : ${service_proxy="NO"}21 (( checkyesno service_ileiden || checkyesno service_proxy ) && checkyesno lvouted_enable ) || exit 022 23 24 15 25 16 TAG=`basename $0` … … 27 18 service lvrouted onestatus > /dev/null && LVROUTED_STATUS="running" || LVROUTED_STATUS="stopped" 28 19 20 check_http() { 21 fetch -o /dev/null -q $* 2>/dev/null 22 } 23 29 24 # Main I-net check 30 fetch -o /dev/null -qhttp://proxy-test.wirelessleiden.nl && INET_STATUS=up25 check_http http://proxy-test.wirelessleiden.nl && INET_STATUS=up 31 26 32 27 if [ $INET_STATUS = "down" ]; then 33 28 # Failback internet check 34 fetch -o /dev/nullhttp://ams-ix.net && INET_STATUS=up29 check_http http://ams-ix.net && INET_STATUS=up 35 30 fi 36 31 … … 40 35 service lvrouted stop | logger -t "$TAG" 41 36 fi 37 38 # Retrieve proxy status 39 export HTTP_PROXY=${HTTP_PROXY-:http://proxy.wleiden.net:3128} 40 PROXY_STATUS=down 41 check_http http://proxy-test.wirelessleiden.nl && PROXY_STATUS=down 42 43 if [ $INET_STATUS = "down" ]; then 44 # Failback internet check 45 check_http http://ams-ix.net && PROXY_STATUS=up 46 fi 47 48 echo -e "internet=$INET_STATUS\nproxy=$PROXY_STATUS" > /tmp/network.status
Note:
See TracChangeset
for help on using the changeset viewer.