[OpenWrt-Devel] Automatic service reload

Lars Boegild Thomsen lth at bright-things.com
Tue Sep 22 22:55:51 EDT 2015


Hi Everybody, 

I am struggling a bit with triggering automatic service reload based on configuration change.

Latest trunk and all that jazz.  New software package called "mqttbridge" which basically is meant to publish ubus method results to mqtt.  Init is in /etc/init.d/mqttbridge, config in /etc/config/mqttbridge.

In the "olden days" this was all defined in /etc/config/ucitrack - something along this line:

config mqttbridge
        option init mqttbridge

However, according to this:

http://wiki.openwrt.org/inbox/procd-init-scripts#procd_triggers_on_config_filenetwork_interface_changes[1] 

It would appear that ucitrack is no longer used?  I have also tried the service_triggers in the init script:

root at pm2:/etc/config# cat /etc/init.d/mqttbridge 
#!/bin/sh /etc/rc.common

START=90

USE_PROCD=1
NAME=mqttbridge
PROG=/usr/sbin/mqttbridge

start_service() 
{
        procd_open_instance
        procd_set_param respawn
        procd_set_param command "$PROG"
        procd_close_instance
}

service_triggers() 
{
        procd_add_reload_trigger "mqttbridge"
}

The thing is - neither approach (or rather both of them) works.  Manual "/etc/init.d/mqttbridge" restart works fine, but automatic reload is never triggered on configuration change.

What did I miss and what is the correct approach.

-- 
Lars Bøgild Thomsen
Public Key: http://bright-things.com/lars-bogild-thomsen/

--------
[1] http://wiki.openwrt.org/inbox/procd-init-scripts#procd_triggers_on_config_filenetwork_interface_changes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150923/c57ee9ab/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/openwrt-devel/attachments/20150923/c57ee9ab/attachment.sig>
-------------- next part --------------
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list