WinSCP can only upload and edit files (unless i have missed the commandline).
And Putty is the other way around, it can’t upload files, but it can do all commands.
That also means that its possible to edit and create files using commands and for example Nano, but you need to install Nano on your router by doing:
opkg update && opkg install nano
I personally use this method. Vi already comes installed on the device but i don’t really like it as an editor.
About Nano & Vi, can we use editor on the router itself to edit files using smartphone?
About Putty, can you show one or two simple commands that is useful in GLinet? Why use Putty in the first place? Why @alzhao said it can be used for learning?
Yeah Nano runs in the router. You can just download something like JuiceSSH if you are on Android to connect to your router, and then just type:
nano <filename>
(After you install nano)
You will then get something that resembles notepad but remotely, and you can type there, paste entire scripts, and then save the file using cntrl+o, and quit using cntrl+x.
Putty is just an SSH terminal program, so the learning part is because you will be able to access all the configuration files on the router and edit them. The GL UI is basically changing configuration files in the background, so you would be able to do the same, but manually and for more advanced configurations.
So I’ll just have to make a new vpn_reconnect.txt file, insert in in the /usr/bin by using WinSCP, then let the script happen in the background?
The script is
#!/bin/sh
#wait for the openvpn to connect for the first time
sleep 120
while [ true ]; do
#check if openvpn is enabled, if not, go to next loop
vpn_enabled=$(uci get glconfig.openvpn.enable)
if [ “$vpn_enabled” != “1” ]; then
echo “VPN not enabled, check 20 seconds later”
sleep 20
continue
fi
if [ -z “$tun0_ifname” ] && [ -z “$vpn_pid” ]; then
echo “VPN enabled but not running, restarting it”
/etc/init.d/startvpn restart
else
echo “VPN is connected and connecting, check 20 seconds later”
fi