What's new

Newbie to Merlin/Scripting - SSH script query

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

AsusNovice

New Around Here
Thank you for any help that can be provided, I have made reasonable efforts to search for answers ;)

Asus RT-AC86U with Merlin 386.3_2. I have used Asus routers for VPN as server and client for some time, but only recently into merlin and now scripting. Experienced C/Windows programmer, which is no doubt a hinderance getting to grips with Linux and SH scripting :mad:

This link is similar to what I am attempting - automatically create a reverse SSH tunnel from the Asus to a known point in the outside world. I have got to:
  • Using Putty to login into router
  • Got scripts running both manually executed, and automatically [e.g. wan-event], and decoded / acting on the $1/$2 entry parameters.
  • Logging to an output file the progress of the script.
  • Getting the rev SSH tunnel setup from the command line:
    dbclient -p xxxx -i /jffs/.ssh/asus -y -R 0.0.0.0:yyyy:localhost:zzzz user@domain.net
What I have yet to crack is getting that line to 'execute' from within the wan-event script; and when I do I'd like to be able to log any output, and keep it running after the script completes. From the thread above, and research, the clue might be in a trailing '&' and/or a leading 'nohup'? I have tried random variations, and strategically placed sleep 10s commands, but no luck. My "log" file (using >> commands) seems to ignore that line.

Any (gentle :rolleyes:) advice / suggestions welcome ...

AN
 
Some forum gurus may correct me on this but in wan-event it should be as easy as
Code:
[ "$2" = 'connected' ] && sh /jffs/scripts/mycustomscript.sh > mycustomscript.log 2>&1 &
 
 
Thank you again :)

That is exactly the issue I had partially solved, but wanted to complete and automate... Not over 4G but from behind Starlink which is also CGNat - and then VPN over the tunnel into the Asus VPN server.

Easy question - I assume on the Asus Merlin dbclient is identical to ssh? i.e. the installed ssh is dropbear's client

AN
 

Latest threads

Sign Up For SNBForums Daily Digest

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