mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 23:48:39 +01:00
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=99
|
||||
USE_PROCD=1
|
||||
PROG=/usr/sbin/vallumd
|
||||
|
||||
add_topic() {
|
||||
procd_append_param command -t "$1"
|
||||
}
|
||||
|
||||
start_service() {
|
||||
local enabled
|
||||
local mqtt_host
|
||||
local mqtt_port
|
||||
|
||||
config_load "vallumd"
|
||||
config_get_bool enabled "mqtt" "enabled" 1
|
||||
[ "$enabled" -gt 0 ] || return 1
|
||||
|
||||
config_get mqtt_host "mqtt" "host"
|
||||
config_get mqtt_port "mqtt" "port"
|
||||
|
||||
procd_open_instance
|
||||
|
||||
procd_set_param command $PROG
|
||||
|
||||
[ -n "$mqtt_host" ] && procd_append_param command -h "$mqtt_host"
|
||||
[ -n "$mqtt_port" ] && procd_append_param command -p "$mqtt_port"
|
||||
config_list_foreach mqtt topics add_topic
|
||||
|
||||
procd_set_param respawn
|
||||
|
||||
procd_close_instance
|
||||
}
|
||||
Reference in New Issue
Block a user