-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathstart-dadbot
More file actions
executable file
·37 lines (30 loc) · 907 Bytes
/
Copy pathstart-dadbot
File metadata and controls
executable file
·37 lines (30 loc) · 907 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
36
37
#!/bin/bash
# read in .env file
source .env
# get argument (this will be cluster ID zero indexed)
CLUSTER_ID=$1
# calculate memory size in MB from GB_MEM environment variable
MEM=$(($GB_MEM * 1024))
# if no argument, exit
if [ -z $CLUSTER_ID ]; then
echo "No cluster ID provided"
exit 1
fi
# if the cluster ID is not a number, exit
if ! [[ $CLUSTER_ID =~ ^[0-9]+$ ]]; then
echo "Cluster ID is not a number"
exit 1
fi
# if the cluster ID is equal to or greater than the number of clusters (the CLUSTERS environment variable), exit
if [[ $CLUSTER_ID -ge $CLUSTERS ]]; then
echo "Cluster ID is greater than the number of clusters"
exit 1
fi
# if the cluster ID is less than zero, exit
if [ $CLUSTER_ID -lt 0 ]; then
echo "Cluster ID is less than zero"
exit 1
fi
CLUSTER_ID=$CLUSTER_ID node --max-old-space-size=$MEM .
# exit with the exit code of the node process
exit $?