Semi-automation Script Based on Sleep

The following script auto login to server 49, send 2 commands and exit from the server.

  1. 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"

  1. Make the script executable: chmod 755 auto.sh;

  2. $ ./auto.sh|telnet

Ref: http://stackoverflow.com/questions/7013137/automating-telnet-session-using-bash-scripts

posted on 2014-03-18 08:14  leechau  阅读(137)  评论(0编辑  收藏  举报

导航