source: hybrid/trunk/nanobsd/files/usr/local/sbin/check-inet-alive@ 10136

Last change on this file since 10136 was 10136, checked in by richardvm, 13 years ago

domme toevoeging van proxy files

  • Property svn:executable set to *
File size: 1005 bytes
Line 
1#!/bin/sh
2#
3# Internet Connection Wrapper From Cron
4#
5# a) Disable lvrouted if the internet is down.
6# b) Re-enable lvrouted if the internet is back up.
7#
8# XXX: Do we need build an fail-save for flapping states?
9# XXX: Do we need to manage state, like DHCP here?
10# XXX: Check if page output is actually the output expected and not some weird captive portal somewhere.
11#
12# Rick van der Zwet <info@rickvanderzwet.nl>
13#
14
15TAG=`basename $0`
16INET_STATUS=down
17service lvrouted onestatus > /dev/null && LVROUTED_STATUS="running" || LVROUTED_STATUS="stopped"
18
19# Main I-net check
20fetch -o /dev/null -q http://proxy-test.wirelessleiden.nl && INET_STATUS=up
21
22if [ $INET_STATUS = "down" ]; then
23 # Failback internet check
24 fetch -o /dev/null http://ams-ix.net && INET_STATUS=up
25fi
26
27if [ $LVROUTED_STATUS = "stopped" ] && [ $INET_STATUS = "up" ]; then
28 service lvrouted start | logger -t "$TAG"
29elif [ $LVROUTED_STATUS = "running" ] && [ $INET_STATUS = "down" ]; then
30 service lvrouted stop | logger -t "$TAG"
31fi
Note: See TracBrowser for help on using the repository browser.