diff --git a/RTCP/Run/src/BGPStats.sh b/RTCP/Run/src/BGPStats.sh
new file mode 100755
index 0000000000000000000000000000000000000000..c107b99d0837961e312e3cdd47025191caa27f20
--- /dev/null
+++ b/RTCP/Run/src/BGPStats.sh
@@ -0,0 +1,9 @@
+#!/bin.rd/sh
+
+#LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
+PATH=$PATH:/usr/local/bin:/opt/lofar/bin:/cephome/gels/projects/LOFAR/RTCP/Run/src/
+#export LD_LIBRARY_PATH PATH
+
+getStats
+
+exit 0
diff --git a/RTCP/Run/src/Run.py b/RTCP/Run/src/Run.py
index 09aa49c5bbf83cbf19a1720b8eb97afbc8a64fb3..5857ff7e97c7b1d62dc924a96a922f4a1f3c1a64 100755
--- a/RTCP/Run/src/Run.py
+++ b/RTCP/Run/src/Run.py
@@ -205,6 +205,8 @@ if __name__ == '__main__':
 	    os.remove(MSdatabaseFile)
     except:
 	print 'caught exception'
+	import traceback
+	traceback.print_exc()
 	sys.exit(1)
 
     obsID = 'L' + dateStr[0] + '_' + '%05d' % measurementnumber
diff --git a/RTCP/Run/src/Stations.py b/RTCP/Run/src/Stations.py
index af183319e9e83cdcd1e4e0c6f0fed696dc550542..726fddcb11240420bbf291fdf026333d956c4752 100644
--- a/RTCP/Run/src/Stations.py
+++ b/RTCP/Run/src/Stations.py
@@ -16,6 +16,8 @@ class Station(object):
     def getPset(self, partition):
 	return IONodes.get(partition).index(self.ionode)
 
+    def getIONode(self):
+        return self.ionode
 
 
 CS001_lba0  = [Station('CS001LBA_LBA0', '10.170.0.1', ['10.170.0.1:4346'])]
diff --git a/RTCP/Run/src/getBGPStats.py b/RTCP/Run/src/getBGPStats.py
new file mode 100755
index 0000000000000000000000000000000000000000..8fc16a8d3333f58b21158148ceb2f293014ce252
--- /dev/null
+++ b/RTCP/Run/src/getBGPStats.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import signal
+import threading
+import time
+
+from Stations import *
+from optparse import OptionParser
+
+command = '"(' + os.getcwd() + '/BGPStats.sh)" 2>/dev/null'
+killcommand = 'killall BGLStats 2> /dev/null'
+killcommand2 = 'killall tcpdump 2> /dev/null'
+
+def failed(ionode):
+  print
+  print ('No LOFAR data on IO node ' + ionode +'. Either the station data is not arriving, or')
+  print ('the Blue Gene/L partition is not active.')
+
+class CommandThread(threading.Thread):
+  def __init__(self, commandstring, ionode):
+    threading.Thread.__init__(self)
+    self.commandstring = commandstring
+    self.ionode = ionode
+
+  def run(self): 
+    # this may hang for a very long time
+    os.system(self.commandstring)
+
+if __name__ == '__main__':
+
+    parser = OptionParser()
+
+    parser.add_option("--stationlist", default="CS001_lba0", action="store", type="string", dest="stationlist", help="Stations to check. Use either a station name (e.g. LBA) or 'all' for all CS1 stations.")
+    # parse the options
+    (options, args) = parser.parse_args()
+
+    # read the stations from Stations.py
+    # todo: WARNING this is very dangerous, because there could be any code in the station string
+    # the exec should probably be replaced by something safer, but this is only a temporary script
+    # This way is convenient because a user can say CS10_4dipoles + CS01_4dipoles
+    try:
+	exec('stationList =' + options.stationlist)
+    except:
+	print 'Cannot parse station configuration: ' + str(options.stationlist)
+	sys.exit(1)
+
+    threads = []
+    
+    for ionode in stationList:
+        t = CommandThread('ssh ' + str(ionode.getIONode()) + ' ' + command, ionode.getIONode())
+        threads.append(t)
+        t.setDaemon(1)
+        t.start()
+	time.sleep(1)
+
+    for t in threads:
+        t.join(3)
+        if (t.isAlive()):
+	    failed(t.ionode)
+
+            killstring = 'ssh ' + t.ionode + ' ' + killcommand
+            os.system(killstring)
+            killstring = 'ssh ' + t.ionode + ' ' + killcommand2
+            os.system(killstring)
+
+        else:
+            threads.remove(t)
+signal.alarm(0)
+sys.exit(0)
+
+
+
+
+
+
+
+
+
diff --git a/RTCP/Run/src/getStats b/RTCP/Run/src/getStats
index eaf9465806eaf48b8d3ee727f0b3709684985187..fbe29a1a2ddf359aa7d93cea74f0924bbd84f515 100755
--- a/RTCP/Run/src/getStats
+++ b/RTCP/Run/src/getStats
@@ -3,7 +3,7 @@
 # Do the first part in a shell script so the startup delay is
 # less unpredictable
 DATAFILE='/tmp/CURINPUT'
-tcpdump -c 10 -i eth1 -X -s 62 -e -n 2> /dev/null > $DATAFILE
+tcpdump -c 10 -i eth0 -X -s 62 -e -n 2> /dev/null > $DATAFILE
 ifconfig | grep HW | awk '{print $1, $5;}' > $DATAFILE.MACS
 ifconfig |grep inet\ addr|awk '{print $2;}'|cut -b 1-5 --complement > $DATAFILE.IPS
 
@@ -11,6 +11,10 @@ python <<EOF
 
 import sys
 import time
+from sets import Set
+
+#index of board in the sourceMac 
+bordIndex = 4
 
 class Packet(object):
   """
@@ -34,8 +38,6 @@ class Packet(object):
   lofarMacStart = '10:fa:00:'
   #index of station in the sourceMac 
   stationIndex = 3
-  #index of board in the sourceMac 
-  bordIndex = 5
 
   #index of the formatstring in the EPAheader
   formatIndex = 4
@@ -67,7 +69,8 @@ class Packet(object):
       srcMac, dstMac = self.getMacs()
       if not srcMac.startswith(self.lofarMacStart):
         return 'not a LOFAR station'
-      return 'CS' + str(int(srcMac.split(':')[self.stationIndex], 16)) + ' board ' + str(int(srcMac.split(':')[self.bordIndex], 16))
+       
+      return 'CS' + str(int(srcMac.split(':')[self.stationIndex], 16)) + ' board ' + str(int(srcMac.split(':')[bordIndex], 16))
     except IndexError:
       return 'not a LOFAR station'
   def getBeamletAndTimes(self):
@@ -120,19 +123,29 @@ def parsefile(inputfile):
   return packets
 
 packets = parsefile('$DATAFILE')
-
 # store all unique (by macs) packets and remember only the first one
 streams = dict()
+lBoardIds = set()
+
 for packet in reversed(packets):
+  IDFound = 0
   ml = packet.getMacs()
+  for id in lBoardIds:
+    if ml[0].split(':')[bordIndex] == id:
+      IDFound = 1
+      break
+  
+  if not IDFound:
+    lBoardIds.add(ml[0].split(':')[bordIndex])
+  
   # if a newer one was already found, it is now forgotten
-  streams[ml] = packet
+  if not IDFound:
+    streams[ml] = packet
 
 mymacs = open('$DATAFILE.MACS').readlines()
 myips = open('$DATAFILE.IPS').readlines()
 
 # analyze each packet for each data stream
-print
 print ('Found the following datastreams:')
 
 # some methods for easier formatting
@@ -144,7 +157,6 @@ def printokornot(text):
   print (' ??? ' + text)
 
 for (srcMac, dstMac), packet in streams.iteritems():
-  print
   beamlets, times = packet.getBeamletAndTimes()
   utcTime = packet.getUTC()
   packetLength = packet.getLength()