#!/bin/bash
#
# We use the jobtracker as provisioning server
#
# Correct start order (reverse to obtain the stop order):
#
# • Zookeeper server
#
HOSTNAME=$( hostname -f )
DOMAIN_N="t.hadoop.research-infrastructures.eu"
SERVICES_START_ORDER="service-zookeeper-server"
SERVICES_STOP_ORDER=$SERVICES_START_ORDER

SERVICES=$SERVICES_START_ORDER
ARG=$1

function action_loop(){
    ACTION=$ARG
    if [ "$ACTION" == "stop" ] ; then
	SERVICES=$SERVICES_STOP_ORDER
    fi
    for SRV in $SERVICES ; do 
	$SRV $ACTION
    done
}

case "$ARG" in
  start|restart|reload|force-reload|status|stop)
        action_loop
        ;;
  *)
        echo "Usage: $0 start|stop|restart|status" >&2
        exit 3
        ;;
esac

exit 0
