I have multiple OpenVPN tunnels created between two networks on gateway devices running OpenWrt.
I need to start/stop an individual instance defined in a section in /etc/config/openvpn without disturbing other tunnels.
On reading through the /etc/init.d/openvpn, I am able to understand that I can start an individual instance by issuing "/etc/init.d/openvpn start section_name", but it is not possible to stop it through the init script.
I tried to send it TERM signal as described here:
https://openwrt.org/docs/guide-developer/procd-init-scripts
#!/bin/sh
PROCD_DEBUG=1
. /lib/functions/procd.sh
procd_send_signal openvpn tunnel2 SIGTERM
But I receive the following output and no signal is sent:
{ "name": "openvpn", "instance": "tunnel2", "signal": 0 }
Command failed: Not found
On modifying the script as below with no instance name and no specific signal:
#!/bin/sh
PROCD_DEBUG=1
. /lib/functions/procd.sh
procd_send_signal openvpn
It successfully sends SIGHUP to all the instances of OpenVPN.
Is there something that I am doing wrong or is it an issue with the ubus / procd that they are not able to honour the command passed to them?
Any help/pointers much appreciated. Thanks in advance.