-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.sh
executable file
·80 lines (66 loc) · 1.79 KB
/
start.sh
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
73
74
75
76
77
78
79
80
#!/usr/bin/env bash
ulimit -c unlimited
LOSSY=$1
NUM_LS=$2
if [ -z $NUM_LS ]; then
NUM_LS=0
fi
BASE_PORT=$RANDOM
BASE_PORT=$[BASE_PORT+2000]
EXTENT_PORT=$BASE_PORT
YFS1_PORT=$[BASE_PORT+2]
YFS2_PORT=$[BASE_PORT+4]
LOCK_PORT=$[BASE_PORT+6]
YFSDIR1=$PWD/yfs1
YFSDIR2=$PWD/yfs2
if [ "$LOSSY" ]; then
export RPC_LOSSY=$LOSSY
fi
if [ $NUM_LS -gt 1 ]; then
x=0
rm config
while [ $x -lt $NUM_LS ]; do
port=$[LOCK_PORT+2*x]
x=$[x+1]
echo $port >> config
done
x=0
while [ $x -lt $NUM_LS ]; do
port=$[LOCK_PORT+2*x]
x=$[x+1]
echo "starting ./lock_server $LOCK_PORT $port > lock_server$x.log 2>&1 &"
./lock_server $LOCK_PORT $port > lock_server$x.log 2>&1 &
sleep 1
done
else
echo "starting ./lock_server $LOCK_PORT > lock_server.log 2>&1 &"
./lock_server $LOCK_PORT > lock_server.log 2>&1 &
sleep 1
fi
unset RPC_LOSSY
echo "starting ./extent_server $EXTENT_PORT > extent_server.log 2>&1 &"
./extent_server $EXTENT_PORT > extent_server.log 2>&1 &
sleep 1
mkdir -p $YFSDIR1
sleep 1
echo "starting ./yfs_client $YFSDIR1 $EXTENT_PORT $LOCK_PORT > yfs_client1.log 2>&1 &"
./yfs_client $YFSDIR1 $EXTENT_PORT $LOCK_PORT > yfs_client1.log 2>&1 &
sleep 1
mkdir -p $YFSDIR2
sleep 1
echo "./yfs_client $YFSDIR2 $EXTENT_PORT $LOCK_PORT > yfs_client2.log 2>&1 &"
./yfs_client $YFSDIR2 $EXTENT_PORT $LOCK_PORT > yfs_client2.log 2>&1 &
sleep 2
# make sure FUSE is mounted where we expect
pwd=`pwd -P`
if [ `mount | grep "$pwd/yfs1" | grep -v grep | wc -l` -ne 1 ]; then
sh stop.sh
echo "Failed to mount YFS properly at ./yfs1"
exit -1
fi
# make sure FUSE is mounted where we expect
if [ `mount | grep "$pwd/yfs2" | grep -v grep | wc -l` -ne 1 ]; then
sh stop.sh
echo "Failed to mount YFS properly at ./yfs2"
exit -1
fi