#!/bin/bash
#
# We use the jobtracker as provisioning server
#
HOSTNAME=$( hostname -f )
DOMAIN_N="t.hadoop.research-infrastructures.eu"

ARG=$1
SERVICE_CMD=/usr/sbin/service
STARTUP_SCRIPT=hadoop-hdfs-journalnode
REMOTE_CMD=dsh
DSH_GROUPNAME=quorum

function ntp_loop(){
    ACTION=$ARG
    dsh -g ${DSH_GROUPNAME} -cM -- restart-ntp
}

function action_loop(){
    ACTION=$ARG
    dsh -g ${DSH_GROUPNAME} -cM -- ${SERVICE_CMD} ${STARTUP_SCRIPT} ${ACTION}
}

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

exit 0

