* [Bismark-commits] rev 315 - trunk/device/OpenWrt_common/scripts
@ 2011-04-06 13:33 bismark
0 siblings, 0 replies; only message in thread
From: bismark @ 2011-04-06 13:33 UTC (permalink / raw)
To: bismark-commits
Author: bismark
Date: 2011-04-06 15:33:28 +0200 (Wed, 06 Apr 2011)
New Revision: 315
Modified:
trunk/device/OpenWrt_common/scripts/action
trunk/device/OpenWrt_common/scripts/probe
Log:
OpenWrt_i586 probe/action porting
Modified: trunk/device/OpenWrt_common/scripts/action
===================================================================
--- trunk/device/OpenWrt_common/scripts/action 2011-04-06 12:41:16 UTC (rev 314)
+++ trunk/device/OpenWrt_common/scripts/action 2011-04-06 13:33:28 UTC (rev 315)
@@ -19,8 +19,10 @@
case $1 in
fwd) # on-demand SSH tunnel
if [ $2 == ${2#*:} ]; then
+ # Default to local port 22
( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $2:127.0.0.1:22 $USER@$SERVER >/dev/null 2>&1 & )
else
+ # To custom IP:PORT destination
( ssh $KEEP_ALIVE -N -i $SSH_KEY -R $2 $USER@$SERVER >/dev/null 2>&1 & )
fi
;;
Modified: trunk/device/OpenWrt_common/scripts/probe
===================================================================
--- trunk/device/OpenWrt_common/scripts/probe 2011-04-06 12:41:16 UTC (rev 314)
+++ trunk/device/OpenWrt_common/scripts/probe 2011-04-06 13:33:28 UTC (rev 315)
@@ -9,7 +9,7 @@
# author: walter.dedonato@unina.it
# Load configuration file
-. ~/conf/dev.conf
+. $BISMARK_DIR/etc/bismark.conf
# Probe message generator
msg () {
@@ -18,19 +18,16 @@
return 0
}
-# Launch startup script during boot
-[ -e /tmp/faults ] || startup
-
# Create status files
-[ -e /tmp/faults ] || echo 0 > /tmp/faults
-[ -e /tmp/proxy ] || echo 0 > /tmp/proxy
+[ -e $BISMARK_DIR/var/faults ] || echo 0 > $BISMARK_DIR/var/faults
+[ -e $BISMARK_DIR/var/proxy ] || echo 0 > $BISMARK_DIR/var/proxy
# Check faults count
-faults=$(cat /tmp/faults)
+faults=$(cat $BISMARK_DIR/var/faults)
if [ $faults -ge 20 ]; then
proxy=$(cat /tmp/proxy)
- echo $(( (proxy + 1) % 2 )) > /tmp/proxy
- echo 0 > /tmp/faults
+ echo $(( (proxy + 1) % 2 )) > $BISMARK_DIR/var/proxy
+ echo 0 > $BISMARK_DIR/var/faults
faults=0
fi
@@ -38,10 +35,10 @@
sleep $((RANDOM % 30))
# Send probe and store reply
-if [ $(cat /tmp/proxy) -eq 1 ]; then
- msg | nc -u $NC_OPTS $PROXY $PROXY_PORT > /tmp/reply
+if [ $(cat $BISMARK_DIR/var/proxy) -eq 1 ]; then
+ msg | nc -u $NC_OPTS $PROXY $PROXY_PORT > $BISMARK_DIR/var/reply
else
- msg | nc -u $NC_OPTS $SERVER $PROBE_PORT > /tmp/reply
+ msg | nc -u $NC_OPTS $SERVER $PROBE_PORT > $BISMARK_DIR/var/reply
fi
# Refresh faults count
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-04-06 13:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-06 13:33 [Bismark-commits] rev 315 - trunk/device/OpenWrt_common/scripts bismark
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox