What's new

Start & stop openvpn server by command line

oversim

Regular Contributor
How can I start or stop openvpn server #1 on my AC68U (latest Merlin) by command line?
I would like to start and stop openvpn using cru... thanks!
 
How can I start or stop openvpn server #1 on my AC68U (latest Merlin) by command line?
I would like to start and stop openvpn using cru... thanks!

Code:
service stop_vpnserver1
service start_vpnserver1
 
This works like a charm, but is there a status version of that command?

I was trying

Code:
service status_vpnclient1

But it just outputs done, like when I start it or stop it.
 
This works like a charm, but is there a status version of that command?

I was trying

Code:
service status_vpnclient1

But it just outputs done, like when I start it or stop it.

Unfortunately the 'service' command will always output 'done' even if the command request is invalid.

However, despite the OP title referring to the VPN Server, if you want to check the status of a VPN Client, you can use a one-line command/script

e.g. Check VPN Client 3
Code:
VPNID=3;VPNSTATE=$(nvram get vpn_client${VPNID}_state); case $VPNSTATE in 2) echo "Client $VPNID UP";;0) echo "Client $VPNID DOWN";;1) echo "Client $VPNID Connecting";;*) echo "Client $VPNID in ERROR";;esac

EDIT: Report all other values such as '-1' as "ERROR" state.
 
Last edited:
Unfortunately the 'service' command will always output 'done' even if the command request is invalid.

However, despite the OP title referring to the VPN Server, if you want to check the status of a VPN Client, you can use a one-line command/script

e.g. Check VPN Client 3
Code:
VPNID=3;VPNSTATE=$(nvram get vpn_client${VPNID}_state); case $VPNSTATE in 2) echo "Client $VPNID UP";;0) echo "Client $VPNID DOWN";;1) echo "Client $VPNID Connecting";;esac

This is amazing, and it works like a charm. Thanks a bunch @Martineau !!!!
 

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top