[OpenWrt-Devel] [PATCH] base-files: procd initscriptsrestartonreload

Felix Fietkau nbd at openwrt.org
Tue Sep 16 08:40:58 EDT 2014


On 2014-09-16 14:18, tristan at trstn.net wrote:
> Felix Fietkau wrote:
>> ...
>> By the way, you mentioned in an earlier email that procd_set_param file
>> did not work for you to restart your service when a config file changes.
>> Can you produce a test case for that? I just tested it myself on a
>> simple service and it worked just fine.
> 
> So I just made a test service:
> 
> root at hg:~# cat /etc/openwrt_version 
> r42538
> root at hg:~# cat /etc/init.d/test 
> #!/bin/sh /etc/rc.common
> 
> START=70
> USE_PROCD=1
> 
> start_service() {
> 	procd_open_instance
> 	procd_set_param command /bin/sleep 10000
> 	procd_set_param file /tmp/test
> 	procd_set_param respawn
> 	procd_close_instance
> }
> 
> root at hg:~# cat /tmp/test
> hello
> root at hg:~# /etc/init.d/test start
> root at hg:~# pidof sleep
> 6958
> root at hg:~# /etc/init.d/test reload
> root at hg:~# pidof sleep
> 6958
> root at hg:~# echo goodbye > /tmp/test
> root at hg:~# pidof sleep
> 6958
> root at hg:~# rm /tmp/test
> root at hg:~# pidof sleep
> 6958
> root at hg:~# echo hello > /tmp/test
> root at hg:~# pidof sleep
> 6958
> root at hg:~# /etc/init.d/test restart
> root at hg:~# pidof sleep
> 6985
You forgot to call reload after changing /tmp/test :)
FYI, I just tested your script, and it works as expected - after
changing the file and calling reload, the pid is different.

- Felix
_______________________________________________
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