Commit 9b8d05a3 authored by Mike Hibler's avatar Mike Hibler

Tweaks to make auto-* work correctly with BSD /bin/sh

Change dbmonitor to, by default, use the latest of A->B and B->A
values when setting characteristics on site A.  Do this for both latency
and bandwidth values, though should probably allow BW values to continue
to be asymmetric.
parent 4b247a8d
......@@ -15,6 +15,17 @@ COMMON_ENV_LOADED="yes"
#
UNAME=`uname -s`
#
# Yow. The BSD shell requires setting trapsasync (-T) to allow us to
# receive signals when in a wait.
#
if [ "$UNAME" = "FreeBSD" ]; then
set -o trapsasync
SH="/bin/sh -T"
else
SH=/bin/sh
fi
#
# Different binary directories for FreeBSD/Linux
#
......@@ -38,7 +49,6 @@ HOSTSFILE="/etc/hosts"
IFCONFIG="/sbin/ifconfig"
PERL="/usr/bin/perl"
PYTHON="${BIN_PATH}/python"
SH=/bin/sh
SUDO="${BIN_PATH}/sudo"
MKDIR="/bin/mkdir"
CHMOD="/bin/chmod"
......
#!/bin/sh
#
# XXX under BSD this script has to be run with -T or else a signal will
# not break the script out of the wait.
#
ARGS=$*
if [ -z "$PID" -o -z "$EID" ]; then
......
......@@ -50,7 +50,7 @@ sub usage()
exit(1);
}
my $optlist = "ndi:ps1S:";
my $optlist = "ndi:ps1S:U";
my $showonly = 0;
my $debug = 0;
my $interval = (1 * 60);
......@@ -58,9 +58,10 @@ my $verbose = 1;
my $onceonly = 0;
my $starttime = 0;
my $timeskew = 0;
my $bidir = 1;
# Default values. Note: delay and PLR are round trip values.
my $DEF_BW = 10; # Kbits/sec
my $DEF_BW = 50; # Kbits/sec
my $DEF_DEL = 1000; # ms
my $DEF_PLR = 0.0; # prob.
......@@ -96,6 +97,9 @@ if (defined($options{"s"})) {
if (defined($options{"1"})) {
$onceonly = 1;
}
if (defined($options{"U"})) {
$bidir = 0;
}
if (defined($options{"S"})) {
my $high = time();
my $low = $high - (23 * 60 * 60); # XXX
......@@ -322,6 +326,20 @@ sub get_plabinfo($@)
$dateclause = "and unixstamp <= $mynow ";
}
#
#
#
my $siteclause;
if ($bidir) {
$siteclause =
"((srcsite_idx='$src_site' and dstsite_idx='$dst_site') or ".
" (dstsite_idx='$src_site' and srcsite_idx='$dst_site')) ";
} else {
$siteclause =
"(srcsite_idx='$src_site' and dstsite_idx='$dst_site') ";
}
#
# BW and latency records are separate and there are, in general,
# a lot more latency measurements than BW measurements. So we
......@@ -333,9 +351,8 @@ sub get_plabinfo($@)
my $query_result =
DBQueryFatal("select latency,unixstamp from pair_data ".
" where ".
" srcsite_idx='$src_site' and ".
" dstsite_idx='$dst_site' and ".
" latency is not null ".
$siteclause .
" and latency is not null ".
$dateclause .
" order by unixstamp desc limit 1");
if (!$query_result->numrows) {
......@@ -349,9 +366,8 @@ sub get_plabinfo($@)
$query_result =
DBQueryFatal("select bw,unixstamp from pair_data ".
" where ".
" srcsite_idx='$src_site' and ".
" dstsite_idx='$dst_site' and ".
" bw is not null ".
$siteclause .
" and bw is not null ".
$dateclause .
" order by unixstamp desc limit 1");
if (!$query_result->numrows) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment