-
Notifications
You must be signed in to change notification settings - Fork 2
/
startclient_loop
executable file
·72 lines (67 loc) · 1.46 KB
/
startclient_loop
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
BASE_DIR=/root/alien-ofelia-conet-ccnx
SERVER=192.168.1.8
PORT=9699
RANGE=2
NID[0]=ccn:/example/mb1
NID[1]=ccn:/example/mb2
#NID[2]=ccn:/example/mb3
NID_CCNX=ccn:/example
TIME=5
while [ $# -gt 0 ]; do
if [ "$1" = "-s" ]; then
if [ $# -lt 2 ]; then
usage
fi
SERVER=$2
shift 2
elif [ "$1" = "-nx" ]; then
if [ $# -lt 2 ]; then
usage
fi
NID_CCNX=$2
shift 2
elif [ "$1" = "-p" ]; then
if [ $# -lt 2 ]; then
usage
fi
PORT=$2
shift 2
elif [ "$1" = "-t" ]; then
if [ $# -lt 2 ]; then
usage
fi
TIME=$2
shift 2
elif [ "$1" = "-n" ]; then
if [ $# -lt 2 ]; then
usage
fi
NID=$2
shift 2
else
break
fi
done
kill $(pidof ccnd) > /dev/null 2>&1
i="0"
#while [ "$i" -lt "15" ]; do
while [ 1 ]; do
if [ "$(pidof ccnd)" ];then
echo "Old CCND pid: $(pidof ccnd)"
# sudo kill $(pidof ccnd)
# fi
else #
$BASE_DIR/csrc/ccnd/ccnd 1 1 0 0 0 > /dev/null 2>&1 &
echo "Attendo avvio di ccnd "
sleep 10
echo "New CCND pid: $(pidof ccnd)"
fi #
number=$RANDOM
let "number %= $RANGE"
$BASE_DIR/csrc/libexec/ccndc add $NID_CCNX udp $SERVER $PORT && $BASE_DIR/csrc/libexec/ccndc add ccnx:/ udp $SERVER
$BASE_DIR/csrc/cmd/ccncatchunks2 -d -p 20 -s ${NID[$number]} &
sleep $TIME
echo "@@@@ risveglio @@@@"
i=$[$i+1]
done