FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
1,042 views 2 comments
by anonymous

Hello,

i have a RUT950 and I would like to run a shell script for "calling home" (since mobile provider does NAT'ing and does not provide port access). I was expecting to run a script from /etc/rc.local,

# Run the script in background to avoid blocking the init process forever...

/home/myuser/call-home &

exit 0

where the call-home script is:

#!/bin/ash
while true ; do
        ssh -T -R 2000:localhost:22 user@myhost sleep 86400
        sleep 30
done

to keep always trying if the connection is interrupted.

That script works from the shell, but when run from rc.local the ssh line keeps failing. What could be the problem?

Or is there a better way to run a script "forever"?

Thanks!

1 Answer

0 votes
by anonymous
Hello,

If you want to run your script continuously you can run it via crontab.

Kindly check this document for your reference: https://we.tl/t-EMWhy8PM7r

Hope it helps

Stay Safe.

Regards,
Jerome
by anonymous
Thanks for the useful reference!

I've finally decided to go with an OpenVPN setup, since i wanted the ssh channel to stay open. The infinite 'while' loop was to handle the case of 'ssh -T' terminating. I have that running in a PC, but in RUT950 the ssh command exits immediately with failure, i don't know why.

Assuming ssh -T would work, with a crontab every run would need to check if there is another instance running, it gets messy.
by anonymous
Hello,

Could you share me the troubleshoot file of your RUT via PM?

Thank you and have a nice day!
Stay Safe.

Regards,
Jerome