#!/bin/bash

# Copyright Security Onion Solutions LLC and/or licensed to Security Onion Solutions LLC under one
# or more contributor license agreements. Licensed under the Elastic License 2.0 as shown at 
# https://securityonion.net/license; you may not use this file except in compliance with the
# Elastic License 2.0.

# shellcheck disable=SC1091
. /usr/sbin/so-common

usage() {
    echo "Usage: $0 <component>"
    echo ""
    echo "Examples:"
    echo "  $0 kibana             Stop Kibana"
    exit 1
}

if [[ $# -lt 1 ]]; then
    usage
fi


#shellcheck disable=SC2154
echo "$banner"
printf "Stopping %s...\n" "$1"
echo "$banner"
case $1 in
	"elasticfleet"|"elastic-fleet")
        docker_check_running "elastic-fleet" "--stop"
        docker rm "so-elastic-fleet" 2> /dev/null
        ;;
    *)
        docker_check_running "$1" "--stop"
        docker rm "so-${1}" 2> /dev/null
    ;;
esac
