The following script auto login to server 49, send 2 commands and exit from the server.
- Create a automation script named "auto.sh":
echo "open 10.0.2.49 -l gcp" sleep 2 echo "gcp" sleep 1 echo "ls" sleep 1 echo "pwd" sleep 3
echo "hadoop fs -put /home/boco/gdpp/91/ hdfs://cloud216:8020/user/boco/gsp/yyyy > mylog"
sleep 3 echo "exit"
-
Make the script executable: chmod 755 auto.sh;
-
$ ./auto.sh|telnet
Ref: http://stackoverflow.com/questions/7013137/automating-telnet-session-using-bash-scripts