#!/bin/sh
#
# Copyright (C) 2015-2016: Alignak team, see AUTHORS.txt file for contributors
#
# This file is part of Alignak.
#
# Alignak is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Alignak 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 Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Alignak.  If not, see <http://www.gnu.org/licenses/>.
#
#
# This file incorporates work covered by the following copyright and
# permission notice:
#
#  Copyright (C) 2009-2014:
#     Gabes Jean, naparuba@gmail.com
#     Gerhard Lausser, Gerhard.Lausser@consol.de
#     Gregory Starck, g.starck@gmail.com
#     Hartmut Goebel, h.goebel@goebel-consult.de
#
#  This file is part of Shinken.
#
#  Shinken is free software: you can redistribute it and/or modify
#  it under the terms of the GNU Affero General Public License as published by
#  the Free Software Foundation, either version 3 of the License, or
#  (at your option) any later version.
#
#  Shinken 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 Affero General Public License for more details.
#
#  You should have received a copy of the GNU Affero General Public License
#  along with Shinken.  If not, see <http://www.gnu.org/licenses/>.

### BEGIN INIT INFO
# Provides:          alignak-reactionner
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Alignak reactionner daemon
# Description:       Alignak is a monitoring tool and the Reactionner
#                    is one of its daemon. This one gets the configuration from the arbiter
#                    His purpose is to get the actually do the actions like sending an email
#                    ordered by the schedulers specified in the configuration
### END INIT INFO

### Chkconfig Header
# Alignak        Starts Alignak Reactionner
#
# chkconfig: 345 99 01
# description: Start Alignak reactionner daemon

# Author: Gabes Jean <naparuba@gmail.com>
#         Olivier LI-KIANG-CHEONG <lkco@gezen.fr>

SHORTNAME=reactionner
NAME="alignak-$SHORTNAME"
SCRIPT=$(readlink -f "$0")
curdir=$(dirname "$SCRIPT")

export ALIGNAK_MODULE_FILE="$NAME"  ## for 'alignak' init script to see that it's called by us

case "$1" in
    start|stop|reload|restart|force-reload|status|check|checkconfig)
        "$curdir/alignak" $@ "$SHORTNAME"
        exit $?
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME [-d] {start|stop|reload|restart|force-reload|status|check}"
        exit 1
        ;;
esac
