-
Notifications
You must be signed in to change notification settings - Fork 7
/
akka
executable file
·99 lines (88 loc) · 2.17 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
93
94
95
96
97
98
99
#!/bin/bash
helpCluster() {
echo "Use the cluster command to start, stop, and view the status of Akka cluster nodes."
echo
echo "./akka cluster [start N | stop | status]"
echo "./akka cluster start N # Starts one or more cluster nodes as specified by N, which must be 1-9."
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, and tail the log of a specific cluster node."
echo "Nodes are started on port 255N and management port 855N, N is the node number 1-9."
echo
echo "./akka node [Start N | stop N | tail N]"
echo "./akka node start N # Start the specified cluster node for nodes 1-9."
echo "./akka node stop N # Stop the specified cluster node for nodes 1-9."
echo "./akka node tail N # Tail the log file of the specified cluster node for nodes 1-9."
}
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
argument=$2
case $command in
"start")
$scriptPath/cluster-start $argument
;;
"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
;;
"tail")
$scriptPath/node-tail $argument
;;
*)
helpNode
;;
esac
}
command() {
command=$1
subCommand=$2
argument=$3
case $command in
"cluster")
clusterCommand $subCommand $argument
;;
"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