next-share: add limit-aware start script
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tue, 21 Sep 2010 08:09:38 +0000 (10:09 +0200)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Tue, 21 Sep 2010 08:43:47 +0000 (10:43 +0200)
Use --download-limit, --upload-limit and --max-connections options for
next-share cmdlinedl.py scripts to enable speed limitation and peer
connections limitations. Use KB_DOWN_LIMIT, KB_UP_LIMIT and CONN_LIMIT
configuration directives.

ControlScripts/clients/next-share/start_nextshare_leecher_limit.sh [new file with mode: 0755]
ControlScripts/clients/next-share/start_nextshare_seeder_limit.sh [new file with mode: 0755]

diff --git a/ControlScripts/clients/next-share/start_nextshare_leecher_limit.sh b/ControlScripts/clients/next-share/start_nextshare_leecher_limit.sh
new file mode 100755 (executable)
index 0000000..c0173e1
--- /dev/null
@@ -0,0 +1,42 @@
+#!/bin/bash
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# Bash script used to start a regular instance of next-share cmd-line
+# The script
+#  * starts a next-share 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
+
+cd $NEXTSHARE_ABS_PATH
+
+export PYTHONPATH=$PYTHONPATH:.
+
+python2.5 BaseLib/Tools/cmdlinedl.py --peer-logging --download-limit ${KB_DOWN_LIMIT} --upload-limit ${KB_UP_LIMIT} --max-connections ${CONN_LIMIT} --output-dir $WORKING_FOLDER_REL_PATH/Regular/ $WORKING_FOLDER_REL_PATH/TorrentsAndData/$TORRENT_FILE
+
+rm -rf $WORKING_FOLDER_REL_PATH/Regular/*
diff --git a/ControlScripts/clients/next-share/start_nextshare_seeder_limit.sh b/ControlScripts/clients/next-share/start_nextshare_seeder_limit.sh
new file mode 100755 (executable)
index 0000000..fd6b77f
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash
+#
+# Copyright: George Milescu 2010 - george.milescu@gmail.com
+#
+# Bash script used to start a seeder instance for the testing topology
+# The script
+#  * 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
+
+cd $NEXTSHARE_ABS_PATH
+
+export PYTHONPATH=$PYTHONPATH:.
+
+python2.5 BaseLib/Tools/cmdlinedl.py --no-hash-check --peer-logging --download-limit ${KB_DOWN_LIMIT} --upload-limit ${KB_UP_LIMIT} --max-connections ${CONN_LIMIT} --output-dir $WORKING_FOLDER_REL_PATH/TorrentsAndData/ $WORKING_FOLDER_REL_PATH/TorrentsAndData/$TORRENT_FILE
+
+rm -rf $WORKING_FOLDER_REL_PATH/Seeder/*