Line 0
Link Here
|
|
|
1 |
#!/bin/sh |
2 |
|
3 |
# $FreeBSD$ |
4 |
# |
5 |
# PROVIDE: wazuh_agent |
6 |
# REQUIRE: LOGIN |
7 |
# KEYWORD: shutdown |
8 |
# |
9 |
# Add these lines to /etc/rc.conf.local or /etc/rc.conf |
10 |
# to enable this service: |
11 |
# wazuh_agent_enable (bool): Set to NO by default. |
12 |
# Set it to YES to enable Wazuh Agent. |
13 |
# |
14 |
|
15 |
. /etc/rc.subr |
16 |
|
17 |
name="wazuh_agent" # How the service will be invoked from service |
18 |
rcvar="${name}_enable" # The variable in rc.conf that will allow this service to run |
19 |
|
20 |
load_rc_config $name # Loads the config file, if relevant. |
21 |
|
22 |
: ${wazuh_agent_enable:="NO"} |
23 |
: ${wazuh_agent_config:="/usr/local/etc/ossec-init.conf"} |
24 |
|
25 |
command="/var/ossec/bin/ossec-control" |
26 |
extra_commands="status" |
27 |
|
28 |
start_cmd="${name}_start" |
29 |
stop_cmd="${name}_stop" |
30 |
status_cmd="${name}_status" |
31 |
|
32 |
wazuh_agent_start() { |
33 |
echo -n "Starting Wazuh: " |
34 |
${command} start > /dev/null |
35 |
RETVAL=$? |
36 |
if [ $RETVAL -eq 0 ]; then |
37 |
echo success |
38 |
else |
39 |
echo failure |
40 |
fi |
41 |
echo |
42 |
return $RETVAL |
43 |
} |
44 |
|
45 |
wazuh_agent_stop() { |
46 |
echo -n "Stopping Wazuh: " |
47 |
${command} stop > /dev/null |
48 |
RETVAL=$? |
49 |
if [ $RETVAL -eq 0 ]; then |
50 |
echo success |
51 |
else |
52 |
echo failure |
53 |
fi |
54 |
echo |
55 |
return $RETVAL |
56 |
} |
57 |
|
58 |
wazuh_agent_status() { |
59 |
${command} status |
60 |
} |
61 |
|
62 |
run_rc_command "$@" |
63 |
|