[OpenWrt-Devel] Automatic service reload
Lars Boegild Thomsen
lth at bright-things.com
Wed Sep 23 04:21:50 EDT 2015
Actually I think it's because the init script is called with a "reload" rather than a restart. Adding this:
reload_service() {
restart
}
to the init script seems to have worked.
I am still a bit confused if /etc/config/ucitrack is still used for anything whatsoever.
On Wednesday 23 September 2015 08:22:42 Florian Eckert wrote:
> You have call the shell script in der /sbin/reload_config
> Am 23.09.2015 4:56 vorm. schrieb "Lars Boegild Thomsen" <
> lth at bright-things.com>:
>
> > 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
> >
> >
> >
> > 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/
> >
> > _______________________________________________
> > openwrt-devel mailing list
> > openwrt-devel at lists.openwrt.org
> > https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
> >
> >
--
Lars Bøgild Thomsen
Mobile: +60 12 361 6644
Public Key: http://bright-things.com/lars-bogild-thomsen/
-------------- 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/3846b511/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