--- /dev/null
+#!/bin/bash
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# Bash script used to detect when a regular client (a leecher) finished downloading a torrent
+# The script
+# * monitors a log file provided as an argument
+# * as long as the doe is not finished the script keeps running
+# * when the doe is finished it returns 0
+# * blocks the caller - the script exits only when the doe has completed the download
+#
+# Script arguments:
+# * log file
+
+if [ ! $# -eq 1 ]; then
+ echo "usage: $0 log-file"
+ exit 1
+fi
+
+LOG_FILE=$1
+
+while true; do
+ if cat $LOG_FILE | grep DLSTATUS_SEEDING &> /dev/null; then
+ exit 0
+ fi
+
+ # Don't do continuous polling
+ sleep 5
+done
--- /dev/null
+#!/bin/bash
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# Bash script used to parse the log file generated by a tribler client and to generate a data file
+#
+# Script arguments:
+# * a folder where the log and data files are stored
+# * the name of a log file in that folder
+
+
+if [ ! $# -eq 2 ]; then
+ echo "usage: $0 log-folder log-file"
+ exit 1
+fi
+
+LOG_FOLDER=$1
+LOG_FILE=$2
+DATA_FILE=$LOG_FOLDER/${LOG_FILE}.data
+
+# Check if the log folder exists
+if [ ! -d $LOG_FOLDER ]; then
+ echo "Error: The folder $LOG_FOLDER does not exist."
+ exit 1
+fi
+
+# Check if the log file exists
+if [ ! -e $LOG_FOLDER/$LOG_FILE ]; then
+ echo "Error: The log file $LOG_FOLDER/$LOG_FILE does not exist."
+ exit 1
+fi
+
+# Check if the log file is a regular file
+if [ ! -f $LOG_FOLDER/$LOG_FILE ]; then
+ echo "Error: The log file $LOG_FOLDER/$LOG_FILE is not a regular file."
+ exit 1
+fi
+
+# Write the header to the data file
+echo "time percent upspeed dlspeed" > $DATA_FILE
+
+# Clean and parse the log file
+cat $LOG_FOLDER/$LOG_FILE | grep "DLSTATUS\|SLEEP" | grep -v "HASHCHECKING" | tr '\t' ' ' | tr -s ' ' | sed -e s/"%"/""/g -e s/"KB\/s"/""/g >> $DATA_FILE.tmp
+
+# Current relative time is=0 (we are at the beginning of the test)
+rel_time=0
+
+# Read all log lines and process the information for the plotting component
+while read FILE_NAME STATUS PERCENT UNKNOWN UP UP_SPEED DOWN DOWN_SPEED; do
+ if [ " $FILE_NAME" = " SLEEP" ]; then
+ rel_time=$(($rel_time + $STATUS))
+ else
+ echo "$rel_time $PERCENT $UP_SPEED $DOWN_SPEED" >>$DATA_FILE
+ rel_time=$(($rel_time + 1))
+ fi
+done <$DATA_FILE.tmp
+
+rm -f $DATA_FILE.tmp
+exit 0
--- /dev/null
+#!/bin/bash
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# Bash script used to start a regular (non doe, non proxy) instance of tribler cmd-line
+# The script
+# * changes current working directory to proxyservice-m32
+# * starts a tribler cmd-line instance with the supplied .torrent file. The .torrent file must be located in the TorrentsAndData folder
+# * at the end deletes the downloaded data
+#
+# If you run this script manually, you must run it from the P2P-Testing-Infrastructure/ControlScripts folder and use one argument: the torrent file name that will be loaded from the TorrentsAndData folder
+#
+
+# Read the global configuration file
+# Check if the global configuration file exists
+if [ ! -e globalconfig ]; then
+ echo "Warning: The global config file globalconfig does not exist."
+else
+ source globalconfig
+fi
+
+# Read the node-specific configuration file (TORRENT_FILE)
+# Check if the node-specific configuration file exists
+if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then
+ echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist."
+else
+ source ../ClientWorkingFolders/TmpLogs/node_config
+fi
+
+if [ " $TORRENT_FILE" = " " ]; then
+ TORRENT_FILE=$1
+fi
+
+export PYTHONPATH=$PYTHONPATH:.
+
+cd $TRIBLER_REL_PATH
+
+python2.6 Tribler/Tools/proxy-cmdline.py --proxymode off --test-mode off --port 25124 --state-dir $WORKING_FOLDER_REL_PATH/Regular/statedir --output-dir $WORKING_FOLDER_REL_PATH/Regular/ $WORKING_FOLDER_REL_PATH/TorrentsAndData/$TORRENT_FILE
+
+rm -rf $WORKING_FOLDER_REL_PATH/Regular/*
--- /dev/null
+#!/bin/bash
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# Bash script used to start a seeder instance for the testing topology
+# The script
+# * changes current working directory to proxyservice-m32
+# * starts a command line BT client seeding the supplied .torrent file. The .torrent file must be located in the TorrentsAndData folder
+#
+# If you run this script manually, you must run it from the P2P-Testing-Infrastructure/ControlScripts folder and use one argument: the torrent file name that will be loaded from the TorrentsAndData folder
+#
+
+# Read the global configuration file
+# Check if the global configuration file exists
+if [ ! -e globalconfig ]; then
+ echo "Warning: The global config file globalconfig does not exist."
+else
+ source globalconfig
+fi
+
+# Read the node-specific configuration file (TORRENT_FILE)
+# Check if the node-specific configuration file exists
+if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then
+ echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist."
+else
+ source ../ClientWorkingFolders/TmpLogs/node_config
+fi
+
+if [ " $TORRENT_FILE" = " " ]; then
+ TORRENT_FILE=$1
+fi
+
+export PYTHONPATH=$PYTHONPATH:.
+
+cd $TRIBLER_REL_PATH
+
+python2.6 Tribler/Tools/proxy-cmdline.py --port 25125 --state-dir $WORKING_FOLDER_REL_PATH/Seeder/statedir --output-dir $WORKING_FOLDER_REL_PATH/TorrentsAndData/ $WORKING_FOLDER_REL_PATH/TorrentsAndData/$TORRENT_FILE
+
+rm -rf $WORKING_FOLDER_REL_PATH/Seeder/*
--- /dev/null
+#!/bin/bash
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# Bash script used to stop all tribler instances
+# The script
+# * stops all the tribler instances
+
+if [ ! $# -eq 0 ]; then
+ echo "usage: $0"
+ exit 1
+fi
+
+pkill python2.6