[or-cvs] r20917: {torflow} Apply NetBSD compatibility patches from Linus Nordberg. (in torflow/trunk/NetworkScanners/BwAuthority: . data/scanner.1 data/scanner.2 data/scanner.3 data/scanner.4)
mikeperry at seul.org
mikeperry at seul.org
Sat Nov 7 21:13:50 UTC 2009
Author: mikeperry
Date: 2009-11-07 16:13:50 -0500 (Sat, 07 Nov 2009)
New Revision: 20917
Modified:
torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py
torflow/trunk/NetworkScanners/BwAuthority/cron.sh
torflow/trunk/NetworkScanners/BwAuthority/data/scanner.1/bwauthority.cfg
torflow/trunk/NetworkScanners/BwAuthority/data/scanner.2/bwauthority.cfg
torflow/trunk/NetworkScanners/BwAuthority/data/scanner.3/bwauthority.cfg
torflow/trunk/NetworkScanners/BwAuthority/data/scanner.4/bwauthority.cfg
torflow/trunk/NetworkScanners/BwAuthority/run_scan.sh
Log:
Apply NetBSD compatibility patches from Linus Nordberg.
Modified: torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py 2009-11-07 18:56:46 UTC (rev 20916)
+++ torflow/trunk/NetworkScanners/BwAuthority/bwauthority.py 2009-11-07 21:13:50 UTC (rev 20917)
@@ -92,9 +92,11 @@
sleep_start = tuple(map(int, sleep_start.split(":")))
sleep_stop = tuple(map(int, sleep_stop.split(":")))
+ pid_file = config.get('BwAuthority', 'pid_file')
+
return (start_pct,stop_pct,nodes_per_slice,save_every,
circs_per_node,out_dir,max_fetch_time,tor_dir,
- sleep_start,sleep_stop,min_streams)
+ sleep_start,sleep_stop,min_streams,pid_file)
def choose_url(percentile):
for (pct, url) in urls:
@@ -258,8 +260,13 @@
TorUtil.read_config(argv[1])
(start_pct,stop_pct,nodes_per_slice,save_every,circs_per_node,out_dir,
max_fetch_time,tor_dir,sleep_start,sleep_stop,
- min_streams) = read_config(argv[1])
+ min_streams,pid_file_name) = read_config(argv[1])
+ if pid_file_name:
+ pidfd = file(pid_file_name, 'w')
+ pidfd.write('%d\n' % os.getpid())
+ pidfd.close()
+
try:
(c,hdlr) = setup_handler(out_dir, tor_dir+"/control_auth_cookie")
except Exception, e:
Modified: torflow/trunk/NetworkScanners/BwAuthority/cron.sh
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/cron.sh 2009-11-07 18:56:46 UTC (rev 20916)
+++ torflow/trunk/NetworkScanners/BwAuthority/cron.sh 2009-11-07 21:13:50 UTC (rev 20917)
@@ -9,7 +9,7 @@
cd $SCANNER_DIR # Needed for import to work properly.
$SCANNER_DIR/aggregate.py $SCANNER_DIR/data $OUTPUT
-if [ $? == 0 ]
+if [ $? = 0 ]
then
cp $OUTPUT $TOR_DEST
#scp $OUTPUT bwscan at torauthority.org:/var/lib/tor.scans/bwscan > /dev/null
Modified: torflow/trunk/NetworkScanners/BwAuthority/data/scanner.1/bwauthority.cfg
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/data/scanner.1/bwauthority.cfg 2009-11-07 18:56:46 UTC (rev 20916)
+++ torflow/trunk/NetworkScanners/BwAuthority/data/scanner.1/bwauthority.cfg 2009-11-07 21:13:50 UTC (rev 20917)
@@ -11,6 +11,7 @@
[BwAuthority]
out_dir = ./data/scanner.1/scan-data
+pid_file = ./data/scanner.1/bwauthority.pid
tor_dir = ./data/tor
start_pct = 0
stop_pct = 12
Modified: torflow/trunk/NetworkScanners/BwAuthority/data/scanner.2/bwauthority.cfg
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/data/scanner.2/bwauthority.cfg 2009-11-07 18:56:46 UTC (rev 20916)
+++ torflow/trunk/NetworkScanners/BwAuthority/data/scanner.2/bwauthority.cfg 2009-11-07 21:13:50 UTC (rev 20917)
@@ -11,6 +11,7 @@
[BwAuthority]
out_dir = ./data/scanner.2/scan-data
+pid_file = ./data/scanner.2/bwauthority.pid
tor_dir = ./data/tor
start_pct = 12
stop_pct = 35
Modified: torflow/trunk/NetworkScanners/BwAuthority/data/scanner.3/bwauthority.cfg
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/data/scanner.3/bwauthority.cfg 2009-11-07 18:56:46 UTC (rev 20916)
+++ torflow/trunk/NetworkScanners/BwAuthority/data/scanner.3/bwauthority.cfg 2009-11-07 21:13:50 UTC (rev 20917)
@@ -11,6 +11,7 @@
[BwAuthority]
out_dir = ./data/scanner.3/scan-data
+pid_file = ./data/scanner.3/bwauthority.pid
tor_dir = ./data/tor
start_pct =35
stop_pct = 60
Modified: torflow/trunk/NetworkScanners/BwAuthority/data/scanner.4/bwauthority.cfg
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/data/scanner.4/bwauthority.cfg 2009-11-07 18:56:46 UTC (rev 20916)
+++ torflow/trunk/NetworkScanners/BwAuthority/data/scanner.4/bwauthority.cfg 2009-11-07 21:13:50 UTC (rev 20917)
@@ -11,6 +11,7 @@
[BwAuthority]
out_dir = ./data/scanner.4/scan-data
+pid_file = ./data/scanner.4/bwauthority.pid
tor_dir = ./data/tor
start_pct =60
stop_pct = 100
Modified: torflow/trunk/NetworkScanners/BwAuthority/run_scan.sh
===================================================================
--- torflow/trunk/NetworkScanners/BwAuthority/run_scan.sh 2009-11-07 18:56:46 UTC (rev 20916)
+++ torflow/trunk/NetworkScanners/BwAuthority/run_scan.sh 2009-11-07 21:13:50 UTC (rev 20917)
@@ -1,14 +1,22 @@
-#!/bin/bash
+#!/bin/sh
+# Number of scanners to run.
+SCANNER_COUNT=4
+
# This tor must have the w status line fix as well as the stream bw fix
# Ie git master or 0.2.2.x
TOR_EXE=../../../tor.git/src/or/tor
PYTHONPATH=../../../SQLAlchemy-0.5.5/lib:../../../Elixir-0.6.1/
-killall bwauthority.py
+for n in `seq $SCANNER_COUNT`; do
+ PIDFILE=./data/scanner.${n}/bwauthority.pid
+ if [ -f $PIDFILE ]; then
+ echo "Killing off scanner $n."
+ kill `head -1 $PIDFILE` && rm $PIDFILE
+ fi
+done
KILLED_TOR=false
-
if [ -f "./data/tor/tor.pid" ]; then
PID=`cat ./data/tor/tor.pid`
kill $PID
@@ -43,10 +51,7 @@
fi
export PYTHONPATH
-
-nice -n 20 ./bwauthority.py ./data/scanner.1/bwauthority.cfg >& ./data/scanner.1/bw.log &
-nice -n 20 ./bwauthority.py ./data/scanner.2/bwauthority.cfg >& ./data/scanner.2/bw.log &
-nice -n 20 ./bwauthority.py ./data/scanner.3/bwauthority.cfg >& ./data/scanner.3/bw.log &
-nice -n 20 ./bwauthority.py ./data/scanner.4/bwauthority.cfg >& ./data/scanner.4/bw.log &
-
-
+for n in `seq $SCANNER_COUNT`; do
+ nice -n 20 ./bwauthority.py ./data/scanner.${n}/bwauthority.cfg \
+ > ./data/scanner.${n}/bw.log 2>&1 &
+done
More information about the tor-commits
mailing list