#!/usr/bin/bash

# chkconfig: 345 20 80
# description: Restores ESwitch configuration.
# processname: restoreeswitchcfg

### BEGIN INIT INFO
# Provides: restoreeswitchcfg
# Required-Start: $local_fs $network $syslog
# Should-Start: 
# Required-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Restores ESwitch configuration
# Description: Restores ESwitch configuration.
### END INIT INFO

start() {

	QAUCLI_LOC=""
	QAUCLI_PKG_INSTALLED=`rpm -qa | grep QConvergeConsoleCLI 2>/dev/null`
	if [ "${QAUCLI_PKG_INSTALLED}" != "" ]; then
		QAUCLI_LOC=`rpm -ql ${QAUCLI_PKG_INSTALLED} | grep -w 'qaucli$' 2>/dev/null`
	fi
	if test ! -f "${QAUCLI_LOC}"
	then
		echo qaucli is not installed
	else
		${QAUCLI_LOC} -npar -restoreeswitchcfg 
    fi
}

stop() {
	echo restoreeswitchcfg service stopped
}


# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        sleep 3
        start
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart}"
        exit 1
esac


