Skip to content

Commit 5bd4c7a

Browse files
author
Chiradeep Vittal
committed
Issue #: 4203 restart java agent
1 parent e9ab931 commit 5bd4c7a

2 files changed

Lines changed: 62 additions & 48 deletions

File tree

‎console-proxy/scripts/_run.sh‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/usr/bin/env bash
2+
#run.sh runs the console proxy.
3+
4+
# make sure we delete the old files from the original template
5+
rm console-proxy.jar
6+
rm console-common.jar
7+
rm conf/cloud.properties
8+
9+
set -x
10+
11+
CP=./:./conf
12+
for file in *.jar
13+
do
14+
CP=${CP}:$file
15+
done
16+
keyvalues=
17+
if [ -f /mnt/cmdline ]
18+
then
19+
CMDLINE=$(cat /mnt/cmdline)
20+
else
21+
CMDLINE=$(cat /proc/cmdline)
22+
fi
23+
#CMDLINE="graphical utf8 eth0ip=0.0.0.0 eth0mask=255.255.255.0 eth1ip=192.168.140.40 eth1mask=255.255.255.0 eth2ip=172.24.0.50 eth2mask=255.255.0.0 gateway=172.24.0.1 dns1=72.52.126.11 template=domP dns2=72.52.126.12 host=192.168.1.142 port=8250 mgmtcidr=192.168.1.0/24 localgw=192.168.140.1 zone=5 pod=5"
24+
for i in $CMDLINE
25+
do
26+
KEY=$(echo $i | cut -s -d= -f1)
27+
VALUE=$(echo $i | cut -s -d= -f2)
28+
[ "$KEY" == "" ] && continue
29+
case $KEY in
30+
*)
31+
keyvalues="${keyvalues} $KEY=$VALUE"
32+
esac
33+
done
34+
35+
tot_mem_k=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}')
36+
let "tot_mem_m=tot_mem_k>>10"
37+
let "eightypcnt=$tot_mem_m*8/10"
38+
let "maxmem=$tot_mem_m-80"
39+
40+
if [ $maxmem -gt $eightypcnt ]
41+
then
42+
maxmem=$eightypcnt
43+
fi
44+
45+
EXTRA=
46+
if [ -f certs/realhostip.keystore ]
47+
then
48+
EXTRA="-Djavax.net.ssl.trustStore=$(dirname $0)/certs/realhostip.keystore -Djavax.net.ssl.trustStorePassword=vmops.com"
49+
fi
50+
51+
java -mx${maxmem}m ${EXTRA} -cp $CP com.cloud.agent.AgentShell $keyvalues $@

‎console-proxy/scripts/run.sh‎

Lines changed: 11 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,14 @@
1-
#!/usr/bin/env bash
2-
#run.sh runs the console proxy.
1+
#!/bin/bash
2+
#run.sh runs the agent client.
33

4-
# make sure we delete the old files from the original template
5-
rm console-proxy.jar
6-
rm console-common.jar
7-
rm conf/cloud.properties
8-
9-
set -x
10-
11-
CP=./:./conf
12-
for file in *.jar
4+
# set -x
5+
6+
while true
137
do
14-
CP=${CP}:$file
8+
./run.sh "$@"
9+
ex=$?
10+
if [ $ex -eq 0 ] || [ $ex -eq 1 ] || [ $ex -eq 66 ] || [ $ex -gt 128 ]; then
11+
exit $ex
12+
fi
13+
sleep 20
1514
done
16-
keyvalues=
17-
if [ -f /mnt/cmdline ]
18-
then
19-
CMDLINE=$(cat /mnt/cmdline)
20-
else
21-
CMDLINE=$(cat /proc/cmdline)
22-
fi
23-
#CMDLINE="graphical utf8 eth0ip=0.0.0.0 eth0mask=255.255.255.0 eth1ip=192.168.140.40 eth1mask=255.255.255.0 eth2ip=172.24.0.50 eth2mask=255.255.0.0 gateway=172.24.0.1 dns1=72.52.126.11 template=domP dns2=72.52.126.12 host=192.168.1.142 port=8250 mgmtcidr=192.168.1.0/24 localgw=192.168.140.1 zone=5 pod=5"
24-
for i in $CMDLINE
25-
do
26-
KEY=$(echo $i | cut -s -d= -f1)
27-
VALUE=$(echo $i | cut -s -d= -f2)
28-
[ "$KEY" == "" ] && continue
29-
case $KEY in
30-
*)
31-
keyvalues="${keyvalues} $KEY=$VALUE"
32-
esac
33-
done
34-
35-
tot_mem_k=$(cat /proc/meminfo | grep MemTotal | awk '{print $2}')
36-
let "tot_mem_m=tot_mem_k>>10"
37-
let "eightypcnt=$tot_mem_m*8/10"
38-
let "maxmem=$tot_mem_m-80"
39-
40-
if [ $maxmem -gt $eightypcnt ]
41-
then
42-
maxmem=$eightypcnt
43-
fi
44-
45-
EXTRA=
46-
if [ -f certs/realhostip.keystore ]
47-
then
48-
EXTRA="-Djavax.net.ssl.trustStore=$(dirname $0)/certs/realhostip.keystore -Djavax.net.ssl.trustStorePassword=vmops.com"
49-
fi
50-
51-
java -mx${maxmem}m ${EXTRA} -cp $CP com.cloud.agent.AgentShell $keyvalues $@

0 commit comments

Comments
 (0)