Rainman_34 Posted January 6, 2017 Share Posted January 6, 2017 So it seems I am missing something here and I can't seem to figure out what I am doing wrong so any help here would be greatly appreciated. I have a Raspberry Pi 3 running Raspbian Jessie Lite and I have a VPS that I want it to automatically connect to. I am having a couple of issues and the first one is when I issue the following command nothing happens and by that I mean a netstat -antp still shows the port closed on the VPS. For security purposes I in the example I am using random port numbers but when I give the command I am using the actual ports that my ssh is running on. autossh -i secretkey.pem -f -N -M 0 1111:localhost:4444 user@VPS -p 5555 -o "ServerAliveInterval 360" -o "ServerAliveCountMax 5" When I issue the following command though autossh works and makes an ssh connection but because I have removed the -f flag it opens a connection in my terminal and once I exit the terminal it closes the connection and the port on my VPS autossh -i secretkey.pem -M 0 1111:localhost:4444 user@VPS -p 5555 -o "ServerAliveInterval 360" -o "ServerAliveCountMax 5" The next issue is that when I put the same command from above into a cronjob with @reboot no connection is made to the VPS when I reboot the Pi. Any help with this is greatly appreciated. Quote Link to comment Share on other sites More sharing options...
digininja Posted January 6, 2017 Share Posted January 6, 2017 Do you know that @reboot is working in Cron? It seems to be quite temperamental http://unix.stackexchange.com/questions/109804/crontabs-reboot-only-works-for-root I'd put the command in rc.local or in a proper init script rather than rely on cron. Quote Link to comment Share on other sites More sharing options...
Rainman_34 Posted January 6, 2017 Author Share Posted January 6, 2017 49 minutes ago, digininja said: Do you know that @reboot is working in Cron? It seems to be quite temperamental http://unix.stackexchange.com/questions/109804/crontabs-reboot-only-works-for-root I'd put the command in rc.local or in a proper init script rather than rely on cron. @reboot is working as I have some other stuff working in there but I will try the rc.local this weekend. Thanks for the help. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.