new upstream release (3.3.0); modify package compatibility for Stretch
[ossec-hids.git] / src / init / ossec-hids-suse.init
1 #!/bin/sh
2 # Author: Scott Knauss scott@knauss.com
3 #
4 # /etc/init.d/ossec
5 #
6 #
7 ### BEGIN INIT INFO
8 # Provides:       ossec
9 # Required-Start: $syslog
10 # Required-Stop:
11 # Default-Start:  2 3 5
12 # Default-Stop:
13 # Description:    Start the ossec HIDS daemon
14 ### END INIT INFO
15
16 # Shell functions sourced from /etc/rc.status:
17 #      rc_check         check and set local and overall rc status
18 #      rc_status        check and set local and overall rc status
19 #      rc_status -v     ditto but be verbose in local rc status
20 #      rc_status -v -r  ditto and clear the local rc status
21 #      rc_failed        set local and overall rc status to failed
22 #      rc_failed <num>  set local and overall rc status to <num>
23 #      rc_reset         clear local rc status (overall remains)
24 #      rc_exit          exit appropriate to overall rc status
25 . /etc/rc.status
26
27 # First reset status of this service
28 rc_reset
29
30 # Return values acc. to LSB for all commands but status:
31 # 0 - success
32 # 1 - generic or unspecified error
33 # 2 - invalid or excess argument(s)
34 # 3 - unimplemented feature (e.g. "reload")
35 # 4 - insufficient privilege
36 # 5 - program is not installed
37 # 6 - program is not configured
38 # 7 - program is not running
39 #
40 # Note that starting an already running service, stopping
41 # or restarting a not-running service as well as the restart
42 # with force-reload (in case signalling is not supported) are
43 # considered a success.
44
45
46 # Reading ossec init conf.
47 if [ -f /etc/ossec-init.conf ]; then
48     . /etc/ossec-init.conf
49 fi
50
51 if [ "X${DIRECTORY}" = "X" ]; then
52     DIRECTORY="/var/ossec"
53 fi
54
55
56 #Just to make sure ossec is installed ...
57 CONTROL="$DIRECTORY/bin/ossec-control"
58
59 test -x $CONTROL || { echo "$CONTROL not installed";
60     if [ "$1" = "stop" ]; then exit 0;
61     else exit 5; fi; }
62
63 start() {
64     ${DIRECTORY}/bin/ossec-control start
65 }
66
67 stop() {
68     ${DIRECTORY}/bin/ossec-control stop
69 }
70
71 status() {
72     ${DIRECTORY}/bin/ossec-control status
73 }
74
75 case "$1" in
76 start)
77     start
78     ;;
79 stop)
80     stop
81     ;;
82 restart)
83     stop
84     start
85     ;;
86 status)
87     status
88     ;;
89 *)
90     echo "*** Usage: $0 {start|stop|restart|status}"
91     exit 1
92 esac
93
94 exit 0