Control Plane Helper Script

From Zenoss Wiki
Revision as of 22:03, 22 May 2014 by Jan.garaj (Talk | contribs)$7

(diff) ← Older revision | Approved revision (diff) | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
#!/bin/sh


echo "Stopping serviced"
sudo stop serviced


# Kill control plane containers


echo "Stopping serviced Containers"


containers=`sudo docker ps -q`
if [ -n "$containers" ]; then
	sudo docker kill $containers
fi


# Start serviced
echo "Starting serviced" 


sudo start serviced 
status serviced


echo "serviced started"


ZENOSSCPUI=0
ZENCOUNT=0

echo "Zenoss Control Plane is starting up..."
sleep 1


while [ "$ZENOSSCPUI" -eq "0" ] && [ "$ZENCOUNT" -lt "20"  ]; do 
        sleep 1     
	ZENCOUNT=$(($ZENCOUNT+1))	
	ZENOSSCPUI=`netstat -an | grep 8787 | wc -l` 
done


if [ "$ZENOSSCPUI" -eq "0" ]; then
	echo "Zenoss Control Plane failed to start. Please check /var/log/upstart/serviced.log for errors."
	sleep 1
else	
	echo "Zenoss Control Plane has started!"
	sleep 1
fi