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 |
|
24 |
command="/var/ossec/bin/ossec-control" |
25 |
extra_commands="status" |
26 |
|
27 |
start_cmd="wazuh_agent_start" |
28 |
stop_cmd="wazuh_agent_stop" |
29 |
status_cmd="wazuh_agent_status" |
30 |
|
31 |
wazuh_agent_start() { |
32 |
echo -n "Starting Wazuh: " |
33 |
${command} start > /dev/null |
34 |
RETVAL=$? |
35 |
if [ $RETVAL -eq 0 ]; then |
36 |
echo success |
37 |
else |
38 |
echo failure |
39 |
fi |
40 |
echo |
41 |
return $RETVAL |
42 |
} |
43 |
|
44 |
wazuh_agent_stop() { |
45 |
echo -n "Stopping Wazuh: " |
46 |
${command} stop > /dev/null |
47 |
RETVAL=$? |
48 |
if [ $RETVAL -eq 0 ]; then |
49 |
echo success |
50 |
else |
51 |
echo failure |
52 |
fi |
53 |
echo |
54 |
return $RETVAL |
55 |
} |
56 |
|
57 |
wazuh_agent_status() { |
58 |
${command} status |
59 |
} |
60 |
|
61 |
run_rc_command "$@" |
62 |
|