forked from IPv4v6/isic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwrapper.sh
executable file
·48 lines (40 loc) · 1.09 KB
/
wrapper.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/sh
# Why is this a shell script instead of Perl? Trinux does not come with perl.
# Trinux is actually rather useful too.
#
# I don't know how well this script works. I've never really used it.
# Parameters
seed=0; # Starting random seed
packets=10000 # How many packets to send before testing connectivity
pingtarget=expert.cc.purdue.edu # Who do we ping to see if we still have
# connectivity.
wgettarget=http://www.microsoft.com/index # What url should we fetch to
# test connectivity... Waste
# mickeysoft's bandwidth :-)
PATH=${PATH}:/usr/local/bin
if test "x$#" = "x0" ; then
echo "Usage: $0 [isic|tcpsic|udpsic|icmpsic] <options>"
exit
fi
program="$* -p ${packets}"
while ( true ); do
run="$program -r ${seed}"
$run
if test $? -ne 0 ; then
exit
fi
# Test connectivity
echo "Testing connectivity"
ping -c5 -i1 -n ${pingtarget}
if test $? -ne 0 ; then
echo "ICMP Connectivity failed on seed $seed."
exit
fi
wget -t2 -T30 -w10 ${wgettarget}
if test $? -ne 0 ; then
echo "TCP Connectivity failed on seed $seed."
exit
fi
rm index
(( seed=seed+1 ))
done