summaryrefslogtreecommitdiff
path: root/net/mosquitto/files/mosquitto.in
blob: f781b772af61e79c52f254ded4005f8f593f37ee (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

# PROVIDE: mosquitto
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown

#
# Add the following lines to /etc/rc.conf to enable mosquitto:
#
# mosquitto_enable="YES"
# mosquitto_flags="<set as needed>"
#
# See mosquitto(8) for flags
#

. /etc/rc.subr

name=mosquitto
rcvar=mosquitto_enable

mosquitto_enable=${mosquitto_enable:="NO"}
mosquitto_config=${mosquitto_config:="%%PREFIX%%/etc/mosquitto/mosquitto.conf"}

command=%%PREFIX%%/sbin/mosquitto
command_args="-c ${mosquitto_config} -d"
pidfile=$(grep pidfile ${mosquitto_config} | awk '{print($2)}')
required_files=${mosquitto_config}

extra_commands="reload"
stop_postcmd=stop_postcmd
stop_postcmd()
{
  rm -f $pidfile
}

load_rc_config $name
run_rc_command "$1"