|
Last change
on this file since 10417 was 10136, checked in by richardvm, 14 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 |
|
|---|
| 15 | TAG=`basename $0`
|
|---|
| 16 | INET_STATUS=down
|
|---|
| 17 | service lvrouted onestatus > /dev/null && LVROUTED_STATUS="running" || LVROUTED_STATUS="stopped"
|
|---|
| 18 |
|
|---|
| 19 | # Main I-net check
|
|---|
| 20 | fetch -o /dev/null -q http://proxy-test.wirelessleiden.nl && INET_STATUS=up
|
|---|
| 21 |
|
|---|
| 22 | if [ $INET_STATUS = "down" ]; then
|
|---|
| 23 | # Failback internet check
|
|---|
| 24 | fetch -o /dev/null http://ams-ix.net && INET_STATUS=up
|
|---|
| 25 | fi
|
|---|
| 26 |
|
|---|
| 27 | if [ $LVROUTED_STATUS = "stopped" ] && [ $INET_STATUS = "up" ]; then
|
|---|
| 28 | service lvrouted start | logger -t "$TAG"
|
|---|
| 29 | elif [ $LVROUTED_STATUS = "running" ] && [ $INET_STATUS = "down" ]; then
|
|---|
| 30 | service lvrouted stop | logger -t "$TAG"
|
|---|
| 31 | fi
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.