#!/bin/sh
#
# name: wazuh
# purpose: Init script for Wazuh
# Copyright (C) 2015-2019, Wazuh Inc. <support@wazuh.com>
#

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

case "$1" in
start)
    if [ -f ${DIRECTORY}/bin/ossec-control ]; then
        echo "Starting Wazuh"
        ${DIRECTORY}/bin/ossec-control start
    fi
    ;;
stop)
    if [ -f ${DIRECTORY}/bin/ossec-control ]; then
        echo "Stopping Wazuh"
        ${DIRECTORY}/bin/ossec-control stop
    fi
    ;;
status)
    if [ -f ${DIRECTORY}/bin/ossec-control ]; then
        ${DIRECTORY}/bin/ossec-control status
    fi
    ;;
restart)
    if [ -f ${DIRECTORY}/bin/ossec-control ]; then
        ${DIRECTORY}/bin/ossec-control restart
    fi
    ;;    
*)
    echo "Usage: $0 (start | stop | restart | status)"
    exit 1
esac
