-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmvsg.sh
63 lines (51 loc) · 1.01 KB
/
mvsg.sh
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
#!/bin/bash
[ -e /etc/sysconfig/mvsg ] && . /etc/sysconfig/mvsg
RANDOM_SLEEP=${RANDOM_SLEEP:-"0"}
OMIT_JVM_STATS=${OMIT_JVM_STATS:-"false"}
SCRIPT=`readlink -f $0`
SCRIPT_PATH=`dirname $SCRIPT`
if [ "xx$ENVIRONMENT" = "xx" ]
then
echo ENVIRONMENT must be set
exit 1
fi
if [ "xx$APP_NAME" = "xx" ]
then
APP_NAME="solr"
fi
if [ "xx$SOLR_HOST" = "xx" ]
then
echo SOLR_HOST must be set
exit 1
fi
if [ "xx$SOLR_PORT" = "xx" ]
then
echo SOLR_PORT must be set
exit 1
fi
if [ "xx$CARBON_HOST" = "xx" ]
then
echo CARBON_HOST must be set
exit 1
fi
if [ "xx$CARBON_PORT" = "xx" ]
then
echo CARBON_PORT must be set
exit 1
fi
if [ "xx$HOSTNAME" = "xx" ]
then
HOSTNAME=`hostname`
fi
OUTPUT=`python $SCRIPT_PATH/mvsg.py $HOSTNAME $ENVIRONMENT $APP_NAME $SOLR_HOST $SOLR_PORT $OMIT_JVM_STATS`
if [ $? = 0 ]
then
if [ "$RANDOM_SLEEP" -gt "0" ]
then
# Sleep for random period of time
R=$RANDOM
R=$(( R %= RANDOM_SLEEP ))
sleep $R
fi
echo "${OUTPUT}" | nc -w 20 $CARBON_HOST $CARBON_PORT
fi