Difference between revisions of "Control Plane Helper Script"

From Zenoss Wiki
Jump to: navigation, search
m (formating)
m (formating)
 
Line 1: Line 1:
  #!/bin/sh
+
#!/bin/sh
 
+
 
+
  echo "Stopping serviced"
+
echo "Stopping serviced"
  sudo stop serviced
+
sudo stop serviced
 
+
 
+
  # Kill control plane containers
+
# Kill control plane containers
 
+
 
+
  echo "Stopping serviced Containers"
+
echo "Stopping serviced Containers"
 
+
 
+
  containers=`sudo docker ps -q`
+
containers=`sudo docker ps -q`
  if [ -n "$containers" ]; then
+
if [ -n "$containers" ]; then
  sudo docker kill $containers
+
sudo docker kill $containers
  fi
+
fi
 
+
 
+
  # Start serviced
+
# Start serviced
  echo "Starting serviced"  
+
echo "Starting serviced"  
 
+
 
+
  sudo start serviced  
+
sudo start serviced  
  status serviced
+
status serviced
 
+
 
+
  echo "serviced started"
+
echo "serviced started"
 
+
 
+
  ZENOSSCPUI=0
+
ZENOSSCPUI=0
  ZENCOUNT=0
+
ZENCOUNT=0
 
+
  echo "Zenoss Control Plane is starting up..."
+
echo "Zenoss Control Plane is starting up..."
  sleep 1
+
sleep 1
 
+
 
+
  while [ "$ZENOSSCPUI" -eq "0" ] && [ "$ZENCOUNT" -lt "20"  ]; do  
+
while [ "$ZENOSSCPUI" -eq "0" ] && [ "$ZENCOUNT" -lt "20"  ]; do  
          sleep 1     
+
        sleep 1     
  ZENCOUNT=$(($ZENCOUNT+1))
+
ZENCOUNT=$(($ZENCOUNT+1))
  ZENOSSCPUI=`netstat -an | grep 8787 | wc -l`  
+
ZENOSSCPUI=`netstat -an | grep 8787 | wc -l`  
  done
+
done
 
+
 
+
  if [ "$ZENOSSCPUI" -eq "0" ]; then
+
if [ "$ZENOSSCPUI" -eq "0" ]; then
  echo "Zenoss Control Plane failed to start. Please check /var/log/upstart/serviced.log for errors."
+
echo "Zenoss Control Plane failed to start. Please check /var/log/upstart/serviced.log for errors."
  sleep 1
+
sleep 1
  else
+
else
  echo "Zenoss Control Plane has started!"
+
echo "Zenoss Control Plane has started!"
  sleep 1
+
sleep 1
  fi
+
fi

Latest revision as of 22:03, 22 May 2014

#!/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