Take a look at Start/stop wireguard by shell
Maybe it would be easier to write a script around the two tasks for stop or start. Something like this should to the trick:
Stop WG
# /etc/init.d/wireguard stop && uci set wireguard.@proxy[0].enable=‘0’
Start WG
# /etc/init.d/wireguard start && uci set wireguard.@proxy[0].enable=‘1’
If you’d like to choose/change the configuration I’m afraid you have to rewrite the init-script.
rm stands for remove …You should not use it in any case, if you are not 100% understanding what is happening. There is no ‘trash’ where you can recover files, like in windows.
Better use mv do move a file, check the service and if everything is okay, remove the file.
Since I have not tested the lines from the linked post, maybe the second one needs to be switched: # uci set wireguard.@proxy[0].enable=‘1’ && /etc/init.d/wireguard start
Unfortunately, I am still unable to switch on Wireguard through SSH, no matter which way around the commands are.
I tried it by starting a new session, from a state when the Wireguard Client was off - nothing happened!
However, the command to turn Wireguard off when it’s already on works perfectly.
Weird, huh?
Do you have any idea what might be complicating things? I only have one WG client profile installed. I just want to replicate the functionality that pressing the ‘connect’ button has when using the portal…
My Beryl is at the moment in production, I’m on the road. My family would not be amused if I test around.
I do think the GL.iNet staff will answer tomorrow faster with a better solution.
Really appreciate the help from the fantastic community here.
Unfortunately, committing doesn’t help either. I’ve even tried reverting firmware to get it to work (to ensure there are no nasties on my end) and, well, it doesn’t. It simply returns a message ‘0’ on an iOS device, or nothing in the mac terminal.
I’m at a loss and out of my depth!
Reason for doing this is I hope to create a siri shortcut to activate the wireguard VPN at the router level, in case you’re wondering. Seems like it’s a long way off…
Yup Siri already supports SSH scripting - not sure about Android. Unfortunately the router app does not support Siri shortcuts (another feature request? :)) so SSH is the way to go…
But we’re already close… if we can figure out how to turn on the VPN (and maybe figure out what script the guy in the other post used!)