-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathserviceTabletServers
More file actions
executable file
·63 lines (59 loc) · 1.6 KB
/
serviceTabletServers
File metadata and controls
executable file
·63 lines (59 loc) · 1.6 KB
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
#!/bin/bash
home=/home/hduser/dspeyer-scratch/spatialtable
IFS=$'\n'
if [ -z "$1" ]
then
echo "usage: serviceTabletServers option inputFile"
echo "where option: start,stop,status"
exit 1
fi
if [ $1 == "start" ]
then
if [ -z $2 ]
then
echo "please enter an inputFile, maybe serverNodes.."
exit 1
else
D=`date | tr -c a-zA-Z0-9 _`
mkdir log/old/before_$D
mv log/*.out log/*.err log/old/before_$D
nodes="$2"
for next in `cat $nodes`
do
ssh $next "$home/start_tablet_server.sh"
echo "started server on $next"
done
exit 0
fi
elif [ $1 == "stop" ]
then
if [ -z $2 ]
then
echo "please enter an inputFile, maybe serverNodes.."
exit 1
else
nodes="$2"
for next in `cat $nodes`
do
kill=$(ssh $next "ps -ef |grep tabletserver | awk '{print \$2;exit;}'")
ssh $next "kill -9 $kill"
echo "killed server on $next"
done
exit 0
fi
elif [ $1 == "status" ]
then
if [ -z $2 ]
then
echo "please enter an inputFile, maybe serverNodes.."
exit 1
else
nodes="$2"
for next in `cat $nodes`
do
echo "status on server: $next"
ssh $next "ps -ef |grep tabletserver |awk '{print ;exit;}'"
done
exit 0
fi
fi