OPNsense Forum
Archive => 20.7 Legacy Series => Topic started by: insecure on September 21, 2020, 04:59:38 pm
-
Hello,
i have the need to restart a openvpn service via cli. With pluginctl -s openvpn restart i can restart the first openvpn server. I have multiple openvpn server. Does anybody know how can i restart server2 for example?
Best reguards,
Marc
-
Hi Marc,
You can use this then: https://github.com/opnsense/core/commit/cf1f4e00b9
# opnsense-patch cf1f4e00b9
Then use the "vpnid" of the OpenVPN instance to restart...
# pluginctl -s openvpn restart 2
Omitting the id will will use the first one it matches. Not a lot of services use this id technique.
Cheers,
Franco
-
i cant find it in pluginctl. you can try
php -r "require_once '/usr/local/etc/inc/config.inc'; require_once '/usr/local/etc/inc/util.inc'; require_once '/usr/local/etc/inc/interfaces.inc'; require_once '/usr/local/etc/inc/plugins.inc.d/openvpn.inc'; openvpn_configure_single([i]vpninstanseid[/i]);"
where vpninstanseid is <vpnid> of server instance in config file
-
oops. sorry)
you fix faster than i write
-
;)
-
checked. works great. a little clarification on the syntax. instance id should be the last:
# pluginctl -s openvpn restart 2
(because of $filter['id'] = $args[2])
-
Right, sorry, I forgot "restart" in the post.
Cheers,
Franco
-
Thanks alot! Works perfect!
Best reguards, Marc