Difference between revisions of "Control Plane Helper Script"

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

Revision as of 22:01, 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