For development purposes, I use a script that automatically connects to a host to do stuff. I always need to hit the [ENTER] key so that it connects and reconnects (upon reboot of the host). I would like to modify it so, that no user interaction is required. How can do this?
I don't need lessons on using the
root account to login, it's all under control - please, just believe me. (embedded platform, no user I/O. Plus
root account will be disabled before going live) There also is no password assigned to it, either!
What I have so far:
#!/bin/bash if [ "$3" == "auto" ] ; then arg= 'sleep 1'; ssharg='-v -o ConnectTimeout=1 -o ConnectionAttempts=1 -o StrictHostKeyChecking=no -p 2222'; else arg= 'read'; ssharg='-o StrictHostKeyChecking=no -p 2222'; fi #$dbg should be executed when connecting with parameter lx dbg=`scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -P 2222 ~/local/script root@$1:/path/to/script`;`ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p 2222 root@$1 -n /path/to/script`; if [ $2 == "lx" ] ; then $dbg; ssh -o StrictHostKeyChecking=no -p 2222 root@$1; echo "Reconnect?";sleep 1; while $arg; < /dev/tty; do $dbg; ssh -o StrictHostKeyChecking=no -p 2222 root@$1; echo "Reconnect?"; done ... More similar elifs checking for other parameters (in $2) without requirement to tun $dbg beforehand ...
Which works fine only that I have to press [ENTER] after launching the script and to reconnect.