Skip to content

Commit

Permalink
Minor bug fix for shell scripts in sandbox directory
Browse files Browse the repository at this point in the history
(#897)
deploy.sh:    extra x in "$1"x == "master_slave". Also add `-h` option which is common in linux shell scripts.
start_bfs.sh: bfs can not work well with raft mode enabled with only sleeping 5 seconds, add 'sleep 30' when using raft mode.
clear.sh:     redirect the error log message like `process not found` to `/dev/null`. It does no good but confuses the users.
start_bfs.sh: `cd -` print the working directory which is useless. Add the server starting message like `start nameserver0 with pid xxx`
  • Loading branch information
lpstudy committed Jun 1, 2017
1 parent 833fae4 commit ff898a4
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 8 deletions.
6 changes: 3 additions & 3 deletions sandbox/clear.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash

killall -9 nameserver
killall -9 chunkserver
killall -9 bfs_client
killall -9 nameserver > /dev/null 2>&1
killall -9 chunkserver > /dev/null 2>&1
killall -9 bfs_client > /dev/null 2>&1

rm -rf nameserver* chunkserver*
rm -rf master* slave*
Expand Down
10 changes: 9 additions & 1 deletion sandbox/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,16 @@ if [ "$1"x = "x" ]; then
ns_num=1;
elif [ "$1x" == "raftx" ]; then
ns_num=3
elif [ "$1x" == "master_slave" ]; then
elif [ "$1" == "master_slave" ]; then
ns_num=2
elif [ "$1" == "-h" ]; then
echo "Usage:"
echo " $0 [mode = none | master_slave | raft | -h]"
echo " none: one nameserver, default mode."
echo " master_slave: two nameservers, one is master and the other is slave."
echo " raft: three nameservers, master server is choosen by inbuilt raft protocol."
echo " -h: show this usage."
exit 0
fi

echo '--default_replica_num=3' >> bfs.flag
Expand Down
6 changes: 6 additions & 0 deletions sandbox/small_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ fi


sleep 5
if [ "$1"x == "raft"x ]; then
sleep 30
fi

# Test sl
./bfs_client ls /
Expand Down Expand Up @@ -110,6 +113,9 @@ do
done;

sleep 10
if [ "$1"x == "raft"x ]; then
sleep 30
fi
./bfs_client get /bin/bfs_client ./binary
rm -rf ./binary

Expand Down
12 changes: 8 additions & 4 deletions sandbox/start_bfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,29 @@ do
cd nameserver$i;
./bin/nameserver --node_index=$i 1>nlog 2>&1 &
echo $! > pid
cd -
echo "start nameserver$i with pid `cat pid`"
cd - > /dev/null
done;

if [ "$1"x == "master_slave"x ]; then
cd nameserver0;
./bin/nameserver --master_slave_role=slave --node_index=0 1>nlog 2>&1 &
echo $! > pid
cd -
echo "start slave nameserver0 with pid `cat pid`"
cd - > /dev/null
sleep 1
cd nameserver1;
./bin/nameserver --master_slave_role=master --node_index=1 1>nlog 2>&1 &
echo $! > pid
cd -
echo "start master nameserver1 with pid `cat pid`"
cd - > /dev/null
fi

for i in `seq 0 3`;
do
cd chunkserver$i;
./bin/chunkserver --chunkserver_port=802$i 1>clog1 2>&1 &
echo $! > pid
cd -
echo "start chunkserver$i with pid `cat pid` at port 802$i"
cd - > /dev/null
done

0 comments on commit ff898a4

Please sign in to comment.