89af2bf2a414c83cf7e13aaf3b946804cab0d7c9
[p2p-testing-infrastructure.git] / ControlScripts / clients / tribler / start_tribler_proxy.sh
1 #!/bin/bash
2 #
3 # Copyright: George Milescu 2010 - george.milescu@gmail.com
4 #
5 # Bash script used to start a proxy instance of tribler for the testing topology
6 # The script
7 #  * changes current working directory to proxyservice-m32
8 #  * starts a tribler cmd-line instance with no target .torrent
9 #  * at the end deletes the state directory
10 #
11 # Script arguments:
12 #  * proxy number [1-4]
13 #
14 # If you run this script manually, you must run it from the P2P-Testing-Infrastructure/ControlScripts folder and use one argument: the the proxy number
15 #
16
17 if [ ! $# -eq 1 ]; then
18         echo "usage: $0 proxy-no"
19         exit 1
20 fi
21
22 # Read the global configuration file
23 # Check if the global configuration file exists
24 if [ ! -e globalconfig ]; then
25         echo "Warning: The global config file globalconfig does not exist."
26 else
27         source globalconfig
28 fi
29
30 # Read the node-specific configuration file
31 # Check if the node-specific configuration file exists
32 if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then
33         echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist."
34 else
35         source ../ClientWorkingFolders/TmpLogs/node_config
36 fi
37
38 # Read arguments
39 PROXY_NO=$1
40
41 export PYTHONPATH=$PYTHONPATH:.
42
43 cd $TRIBLER_REL_PATH
44
45 python2.6 Tribler/Tools/proxy-cmdline.py --proxymode off --proxyservice on --port 25123 --test-mode helper --state-dir $WORKING_FOLDER_REL_PATH/Proxy$PROXY_NO/statedir --no-download
46
47 rm -rf $WORKING_FOLDER_REL_PATH/Proxy$PROXY_NO/*