-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathakka
executable file
·92 lines (81 loc) · 1.96 KB
/
akka
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
81
82
83
84
85
86
87
88
89
90
91
92
#!/bin/bash
helpCluster() {
echo "Use the cluster command to start, stop, and view the status of Akka cluster nodes."
echo
echo "./akka cluster [start | stop | status]"
echo "./akka cluster start # Starts one Akka cluster."
echo "./akka cluster stop # Stops all currently cluster nodes."
echo "./akka cluster status # Shows an Akka Management view of the cluster status/state."
}
helpNode() {
echo "Use the node command to start, stop a specific cluster node."
echo
echo "./akka node start [port] [role] [seed node] [kafka server] # Start the specified cluster node."
echo "./akka node stop [port] # Stop the specified cluster node."
}
helpAll() {
echo "This CLI is used to start, stop and monitor nodes in an Akka cluster."
echo
echo "These commands manage the Akka cluster as defined in this project. A cluster"
echo "of nodes is started using the JAR file build from this project's Maven POM file."
echo
helpCluster
echo
helpNode
}
clusterCommand() {
command=$1
case $command in
"start")
$scriptPath/cluster-start
;;
"stop")
$scriptPath/cluster-stop
;;
"status")
$scriptPath/cluster-status
;;
*)
helpCluster
;;
esac
}
nodeCommand() {
command=$1
argument="${@:2}"
case $command in
"start")
$scriptPath/node-start $argument
;;
"stop")
$scriptPath/node-stop $argument
;;
*)
helpNode
;;
esac
}
command() {
command=$1
subCommand=$2
argument="${@:3}"
case $command in
"cluster")
clusterCommand $subCommand
;;
"node")
nodeCommand $subCommand $argument
;;
*)
echo "Invalid command '$command'"
echo
helpAll
;;
esac
}
scriptPath=$(dirname $0)
if [ $# -eq 0 ] ; then
helpAll
else
command $1 $2 "${@:3}"
fi