-
Notifications
You must be signed in to change notification settings - Fork 3
/
node-start
executable file
·34 lines (28 loc) · 1.11 KB
/
node-start
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
#!/bin/bash
# Use this script to start one Akka cluster node. The command line parameter must be from 1 to 9. The
# node's JVMs is started as a background process. The process logs both stdin and stderr to a file located in
# the /tmp directory. The log file name is derived from the current directory name with a suffix of "-N.log",
# N is the node number. The Akka port number is set to 255N, N is the node number.
usage() {
echo "Usage: $0 node - Start cluster node, node number must 1 through 9." ; exit 1
}
[ $# -eq 0 ] && usage
node=$1
scriptPath=$(dirname $0)
scriptPath=$(dirname $0)
scriptPathFull=$(cd $(dirname $0) ; pwd -P)
scriptFilename=$(basename $scriptPathFull)
jarFilename=$(find $scriptPath/target -name *allinone.jar*)
startNode() {
node=$1
port="255"$node
export akka_management_http_port="855"$node
echo "Start node $1 on port $port, management port $akka_management_http_port"
java -jar $jarFilename $port &> /tmp/$scriptFilename-$node.log &
}
if [[ $node =~ ^[1-9]$ ]] ; then
startNode $node
else
echo "Cluster node number $node is invalid. The node number must be 1 through 9."
usage
fi