it could start through rc.local, if the connection dies it'd loop until the
communication is reestablished (assuming the remove host actually kills
the active connection on reboot / shutdown).
You could give ser2net a shot, it even has a LuCI interface (luci-app-ser2net). I use in server mode on OpenWrt to serve my Z-Wave adapter to Home Assistant.
thanks, yes, I need a script.
The problem is when the server is down and restart, my router could not know, I did not get any info on terminal when the connection is down. Maybe something wrong.
Maybe someone help me to ask chatGPT, to check what we got (I cannot use chatGPT in my local).
from the [-h] help output, use [-d -d] options, I can get the connection status and back to shell when disconnected.
then I could add reconnect process in the loop of the script.
Once you have the script exit on loss of connection, make it a service in init.d so if it loses connection or crashes out for any other reason, the init system will take care of restarting it.