407f4293c374d76713182569010c50bbf5dda683
[utp-swift.git] / local_start_utp_receiver
1 #!/bin/bash
2
3 # load config
4 source ./config
5
6 cleanup()
7 {
8         kill -TERM $client_pid > /dev/null 2>&1
9         kill -TERM $hook_pid > /dev/null 2>&1
10 }
11
12 # remove receiver data, if any
13 rm -fr $LEECHER_DIR/*
14
15 > $UTP_RECEIVER_OUT_LOG
16 > $UTP_RECEIVER_LOG_FILE
17 > $UTP_RECEIVER_MONITOR_LOG
18
19 # start client
20 $UTP_RECEIVER $UTP_RECEIVER_LOG_FILE $UTP_RECEIVER_PORT $LEECHER_DATA >> $UTP_RECEIVER_OUT_LOG 2>&1 &
21 client_pid=$!
22
23 # start monitoring on pid
24 ./hook_monitor_pid $client_pid >> $UTP_RECEIVER_MONITOR_LOG 2>&1 &
25 hook_pid=$!
26
27 trap cleanup 0 1 2 3 15
28
29 wait