new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / init / ossec-hids-rh.init
1 #!/bin/sh
2 # OSSEC         Controls OSSEC HIDS on Redhat-based systems
3 # Author:       Kayvan A. Sylvan <kayvan@sylvan.com>
4 # Author:       Daniel B. Cid <dcid@ossec.net>
5 #
6 # chkconfig: 2345 99 15
7 # description: Starts and stops OSSEC HIDS (Host Intrusion Detection System)
8 #
9 # This will work on Redhat systems (maybe others too)
10
11 # Source function library.
12 export LANG=C
13
14 . /etc/init.d/functions
15 . /etc/ossec-init.conf
16
17 if [ "X${DIRECTORY}" = "X" ]; then
18     DIRECTORY="/var/ossec"
19 fi
20
21 start() {
22     echo -n "Starting OSSEC: "
23     ${DIRECTORY}/bin/ossec-control start > /dev/null
24     RETVAL=$?
25     if [ $RETVAL -eq 0 ]; then
26         success
27     else
28         failure
29     fi
30     echo
31     return $RETVAL
32 }
33
34 stop() {
35     echo -n "Stopping OSSEC: "
36     ${DIRECTORY}/bin/ossec-control stop > /dev/null
37     RETVAL=$?
38     if [ $RETVAL -eq 0 ]; then
39         success
40     else
41         failure
42     fi
43     echo
44     return $RETVAL
45 }
46
47 status() {
48     ${DIRECTORY}/bin/ossec-control status
49     RETVAL=$?
50     return $RETVAL
51 }
52
53 case "$1" in
54 start)
55     start
56     ;;
57 stop)
58     stop
59     ;;
60 restart)
61     stop
62     start
63     ;;
64 status)
65     status
66     ;;
67 *)
68     echo "*** Usage: ossec {start|stop|restart|status}"
69     exit 1
70 esac
71
72 exit $?