3 # 2010 Calin-Andrei Burloiu, calin.burloiu@gmail.com
5 # Bash script used to start a swift instance
7 # * changes current working directory to TorrentsAndData
8 # * starts a swift session
9 # * at the end deletes the downloaded data
11 # If you run this script manually, you must run it from the P2P-Testing-Infrastructure/ControlScripts folder
14 # Read the global configuration file
15 # Check if the global configuration file exists
16 if [ ! -e globalconfig ]; then
17 echo "Warning: The global config file globalconfig does not exist."
22 # Read the node-specific configuration file (TORRENT_FILE)
23 # Check if the node-specific configuration file exists
24 if [ ! -e ../ClientWorkingFolders/TmpLogs/node_config ]; then
25 echo "Warning: The global config file ../ClientWorkingFolders/TmpLogs/node_config does not exist."
27 source ../ClientWorkingFolders/TmpLogs/node_config
30 # convert host_id and veid to veth IP address in 10.0.0.0/8 network
35 ip_part1=$(($veid / 100))
36 ip_part2=$(($veid % 100))
37 id=$(echo "$host_id" | awk '{printf "%d", $1;}')
38 echo "10.$ip_part1.$id.$ip_part2"
41 # convert p2p-next-${host_id}-${veid} hostname to veth IP address
50 host_veid_to_eth_ip $host_id $veid
53 OWN_IP=$(hostname_to_ip $(hostname))
54 DATA_PATH=$WORKING_FOLDER_REL_PATH/TorrentsAndData/
58 ./swift -f ${DATA_PATH}/${TORRENT_FILE} -l ${OWN_IP}:6881 -p