#!/bin/sh

# Copyright (C) 2015-2020, Wazuh Inc.
# OSSEC         Controls Wazuh
# Author:       Daniel B. Cid <dcid@ossec.net>
# Modified for Debian by Michael Starks (patch by Costas Drogos)

### BEGIN INIT INFO
# Provides:          ossec
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Should-Start:      $network
# Should-Stop:       $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start and stop Wazuh
# Description:       Controls Wazuh daemons
#
### END INIT INFO

. /etc/ossec-init.conf
if [ "X${DIRECTORY}" = "X" ]; then
    DIRECTORY="/var/ossec"
fi

start() {
    ${DIRECTORY}/bin/ossec-control start
}

stop() {
    ${DIRECTORY}/bin/ossec-control stop
}

status() {
    ${DIRECTORY}/bin/ossec-control status
}

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