Skip to content
K99advantedge 933 B
Newer Older
#!/bin/sh -e

DESC="AdvantEDGE platform"
TIMEOUT=7
IS_RUNNING=`kubectl get pods --all-namespaces | grep "meep-virt-engine" | awk '{print $2}'`
start_advantedge() {
    if [ -z $IS_RUNNING ] ; then
	meepctl deploy dep
	sleep $TIMEOUT
	meepctl deploy core
	sleep $TIMEOUT
	kubectl get pods --all-namespaces
    fi
}

stop_advantedge() {
    if [ -n $IS_RUNNING ]; then
	meepctl delete core
	sleep $TIMEOUT
	meepctl delete dep
	sleep $TIMEOUT
	kubectl get pods --all-namespaces
    fi
    IS_RUNNING=`kubectl get pods --all-namespaces | grep "meep-virt-engine" | awk '{print $2}'`
}

case "$1" in
start)
  echo "Starting $DESC"
  start_advantedge

  ;;
stop)
  echo "Stoping $DESC"
  stop_advantedge
  
  ;;
restart)
  echo "Reloading $DESC"
  stop_advantedge
  sleep $TIMEOUT
  start_advantedge

  ;;

status)
  kubectl get pods --all-namespaces
  ;;
  
*)
  echo "Usage: $0 {start|stop|restart|status}" >&2
  exit 1
  ;;
esac

exit 0