make both check lines consistent

No need to make a variable, use it on one place and hardcode it on another.
This commit is contained in:
Remi Bergsma 2015-12-16 14:45:57 +01:00
parent 525949e027
commit 8fb677027d

View File

@ -17,14 +17,13 @@
# under the License.
STATUS=UNKNOWN
INTERFACE=eth1
ROUTER_TYPE=$(cat /etc/cloudstack/cmdline.json | grep type | awk '{print $2;}' | sed -e 's/[,\"]//g')
if [ "$ROUTER_TYPE" = "router" ]
then
ROUTER_STATE=$(ip addr | grep eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo "MASTER"; else echo "BACKUP"; fi')
STATUS=$ROUTER_STATE
else
ROUTER_STATE=$(ip addr | grep $INTERFACE | grep state | awk '{print $9;}')
ROUTER_STATE=$(ip addr | grep eth1 | grep state | awk '{print $9;}')
if [ "$ROUTER_STATE" = "UP" ]
then
STATUS=MASTER