add network interface specifications to iptables rules
[utp-swift.git] / local_start_utp_sender
1 #!/bin/bash
2
3 # load config
4 source ./config
5
6 if test $# -ne 1; then
7         echo "Usage: $0 receiver_ip" 1>&2
8         exit 1
9 fi
10
11 cleanup()
12 {
13         kill -TERM $client_pid > /dev/null 2>&1
14         kill -TERM $hook_pid > /dev/null 2>&1
15 }
16
17 > $UTP_SENDER_OUT_LOG
18 > $UTP_SENDER_LOG_FILE
19 > $UTP_SENDER_MONITOR_LOG
20
21 # start client
22 $UTP_SENDER $UTP_SENDER_LOG_FILE $receiver_ip:$UTP_RECEIVER_PORT $SEEDER_DATA >> $UTP_SENDER_OUT_LOG 2>&1 &
23 client_pid=$!
24
25 # start monitoring on pid
26 ./hook_monitor_pid $client_pid >> $UTP_SENDER_MONITOR_LOG 2>&1 &
27 hook_pid=$!
28
29 trap cleanup 0 1 2 3 15
30
31 wait