blob: 818931213e437fe6c7ab76e32ed056eb682acb61 (
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
|
#!/sbin/openrc-run
MOSQUITTO_CFG="${MOSQUITTO_CFG:-/etc/mosquitto/${RC_SVCNAME}.conf}"
command="/usr/bin/mosquitto"
command_args="-c '${MOSQUITTO_CFG}' $command_args"
command_args_background="--daemon"
pidfile="$(awk '$1 == "pid_file" {print $2}' "${MOSQUITTO_CFG}" || true)"
extra_started_commands="reload"
description_reload="Reload configuration"
start_pre() {
if ! [ -e "$MOSQUITTO_CFG" ]; then
eerror "$MOSQUITTO_CFG does not exist"
return 1
fi
if [ -z "$pidfile" ]; then
eerror "${MOSQUITTO_CFG} is missing the pid_file option"
return 1
fi
MOSQUITTO_LOG="$(awk '$1 " " $2 == "log_dest file" {print $3}' "${MOSQUITTO_CFG}")"
if [ -n "$MOSQUITTO_LOG" ]; then
MOSQUITTO_USER="$(awk '$1 == "user" {print $2}' "${MOSQUITTO_CFG}")"
MOSQUITTO_USER="${MOSQUITTO_USER:-mosquitto}"
checkpath -fm 660 -o "${MOSQUITTO_USER}" \
"${MOSQUITTO_LOG}" || return 1
fi
}
reload() {
ebegin "Reloading ${RC_SVCNAME}"
start-stop-daemon --signal HUP --pidfile "${pidfile}"
eend $?
}
|