--- /dev/null
+#!/bin/bash
+#
+# 2010, Calin-Andrei Burloiu, calin.burloiu@gmail.com
+#
+# Bash script used to detect when a regular client 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
+ # check for complete transfer
+ if cat $LOG_FILE | grep "DONE" &> /dev/null; then
+ echo "Torrent transfer finished"
+ exit 0
+ fi
+
+ if cat $LOG_FILE | grep "Segmentation fault" &> /dev/null; then
+ echo "Segmentation fault when transferring torrent"
+ exit 0
+ fi
+
+ # check stat client is alive
+ if ! pgrep "swift" &> /dev/null; then
+ if ! pgrep -f "schedule_client.sh" &> /dev/null; then
+ echo "No swift and no schedule_client.sh process"
+ exit 0
+ fi
+ fi
+
+ # Don't do continuous polling
+ sleep 5
+done
--- /dev/null
+#!/bin/bash
+#
+# 2010 Calin-Andrei Burloiu, calin.burloiu@gmail.com
+#
+# Bash script used to start a swift instance
+# The script
+# * changes current working directory to TorrentsAndData
+# * starts a swift session
+# * at the end deletes the downloaded data
+#
+# If you run this script manually, you must run it from the P2P-Testing-Infrastructure/ControlScripts 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
+
+HASH=$(echo $TORRENT_FILE | cut -d"/" -f1)
+TRACKER_IP=$(echo $TORRENT_FILE | cut -d"/" -f2)
+
+cd $SWIFT_ABS_PATH
+
+./swift -h $HASH -t ${TRACKER_IP}:6881 -p
+
+#rm -f ${HASH}*
--- /dev/null
+#!/bin/bash
+#
+# 2010 Calin-Andrei Burloiu, calin.burloiu@gmail.com
+#
+# Bash script used to start a swift instance
+# The script
+# * changes current working directory to TorrentsAndData
+# * starts a swift session
+# * at the end deletes the downloaded data
+#
+# If you run this script manually, you must run it from the P2P-Testing-Infrastructure/ControlScripts 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
+
+# convert host_id and veid to veth IP address in 10.0.0.0/8 network
+host_veid_to_eth_ip()
+{
+ host_id=$1
+ veid=$2
+ ip_part1=$(($veid / 100))
+ ip_part2=$(($veid % 100))
+ id=$(echo "$host_id" | awk '{printf "%d", $1;}')
+ echo "10.$ip_part1.$id.$ip_part2"
+}
+
+# convert p2p-next-${host_id}-${veid} hostname to veth IP address
+hostname_to_ip()
+{
+ hostname=$1
+
+ veid=${hostname##*-}
+tmp=${hostname%-*}
+ host_id=${tmp##*-}
+
+ host_veid_to_eth_ip $host_id $veid
+}
+
+OWN_IP=$(host_name_to_ip $(hostname))
+DATA_PATH=$WORKING_FOLDER_REL_PATH/TorrentsAndData/
+
+cd $SWIFT_ABS_PATH
+
+./swift -f ${DATA_PATH}/${TORRENT_FILE} -l ${OWN_IP}:6881 -p
--- /dev/null
+#!/bin/bash
+#
+# 2010, Calin-Andrei Burloiu. calin.burloiu@gmail.com
+#
+# Bash script used to stop all swift instances
+# The script
+# * stops all the swift instances
+
+if [ ! $# -eq 0 ]; then
+ echo "usage: $0"
+ exit 1
+fi
+
+pkill swift
-/*campaign*
-/*performance*
-/tsup*
+*campaign*
+*performance*