#!/bin/bash
#
# chkconfig: 35 94 12
# description: eosslave - configuration service making 'eos' services running in slave mode
#

# ----------------------------------------------------------------------
# File: eosslave
# Author: Andreas-Joachim Peters - CERN
# ----------------------------------------------------------------------

# ************************************************************************
# * EOS - the CERN Disk Storage System                                   *
# * Copyright (C) 2011 CERN/Switzerland                                  *
# *                                                                      *
# * This program is free software: you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation, either version 3 of the License, or    *
# * (at your option) any later version.                                  *
# *                                                                      *
# * This program is distributed in the hope that it will be useful,      *
# * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
# * GNU General Public License for more details.                         *
# *                                                                      *
# * You should have received a copy of the GNU General Public License    *
# ************************************************************************


# Get function from functions library
. /etc/init.d/functions
. /etc/sysconfig/eos

# Start the eosslave pseudo service
start() {
	echo -n Configure EOS in slave mode 
	service eosha status >& /dev/null && service eosha stop >& /dev/null
	service eos status mgm >& /dev/null && service eos stop mgm >& /dev/null
	service eos status mq >& /dev/null && service eos stop mq >& /dev/null
	service eos slave mgm >& /dev/null
	service eos slave mq >& /dev/null
        success $"eosslave execution"
        echo
}

# Stop the eosslave pseudo service
stop() {
	echo -n
}

### main logic ###
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  status)
        ;;
  restart|reload|condrestart)
        stop
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
        exit 1
esac

exit 0