-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathnode-kill
More file actions
executable file
·35 lines (28 loc) · 830 Bytes
/
node-kill
File metadata and controls
executable file
·35 lines (28 loc) · 830 Bytes
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
#!/bin/bash
# Use this script to kill (kill -9) one or more Akka cluster nodes. The command line parameters must be from 1 to 9.
usage() {
echo "Usage: $0 nodes - Kill cluster nodes, node numbers must be 1 through 9." ; exit 1
}
killNode() {
node=$1
port="255"$node
echo "Kill node $1 on port $port"
if hash pkill 2>/dev/null; then
pkill -9 -f "$(basename "$jarFilename") $port"
else
echo "Error: pkill command required. For cygwin please intatll the procps-ng package."
fi
}
[ $# -eq 0 ] && usage
scriptPath=$(dirname "$0")
jarFilename=$(find "$scriptPath"/target -name "*allinone.jar*")
while [[ $# -gt 0 ]]; do
node=$1
shift
if [[ $node =~ ^[1-9]$ ]] ; then
killNode "$node"
else
echo "Cluster node number $node is invalid. The node number must be 1 through 9."
usage
fi
done