Advertisement
Guest User

Untitled

a guest
Aug 5th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. # i have a raspberry pi. i want run ssh tunnel when system is starting
  2. # i created script /usr/local/sbin/create_tunnel.sh
  3.  
  4. #!/bin/sh
  5.  
  6. /usr/bin/ssh -f -i /home/pi/.ssh/key.pem user@host -N -R 51151:localhost:5222
  7.  
  8. if [[ $? -eq 0 ]]; then
  9. echo "Tunnel to host created successfully"
  10. else
  11. echo "An error occurred creating a tunnel to host. RC was $?"
  12. fi
  13.  
  14.  
  15. # changed "chmod +x" and added task to crontab
  16. # crontab -e
  17.  
  18. @reboot /usr/local/sbin/create_tunnel.sh > /usr/local/sbin/tunnel.log
  19.  
  20. # after reboot i see in log: An error occurred creating a tunnel to host. RC was 127
  21. # why?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement