[LEDE-DEV] procd & custom reload support

Rafał Miłecki zajec5 at gmail.com
Thu Jan 12 15:19:29 PST 2017


Hi,

I've app that reads config from /etc/foo.conf and I use init.d script
to generate that file based on /etc/config/foo.

A nice feature my app has is runtime config reload triggered by
kill -SIGUSR1 $PID

I guess I need something like this:
start_service() {
        local port
        config_load "foo"
        config_get port basic port
        echo $port > /etc/foo.conf

        procd_open_instance
        procd_set_param command /sbin/foo
        procd_set_param file /etc/foo.conf
        procd_close_instance
}

Now, reloading... I know I could do:
reload_service {
        local pid="$(pgrep /sbin/foo)"
        kill -SIGUSR1 $pid
}

But this would be called on every
/etc/init.d/foo reload

What I'd like to achieve is procd monitoring /etc/foo.conf and calling
my custom reload function if there is a real need to reload service.

Is that possible with procd?

-- 
Rafał



More information about the Lede-dev mailing list