home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / misc / 4606 < prev    next >
Encoding:
Text File  |  1992-12-16  |  2.2 KB  |  63 lines

  1. Newsgroups: comp.unix.misc
  2. Path: sparky!uunet!zaphod.mps.ohio-state.edu!cs.utexas.edu!uwm.edu!spool.mu.edu!agate!stanford.edu!rock!concert!sas!mozart.unx.sas.com!sasmob
  3. From: sasmob@chewy.unx.sas.com (Mark Burhans)
  4. Subject: Re: How to automate Telnet sessions?
  5. Originator: sasmob@chewy.unx.sas.com
  6. Sender: news@unx.sas.com (Noter of Newsworthy Events)
  7. Message-ID: <BzDJwD.8Fx@unx.sas.com>
  8. Date: Wed, 16 Dec 1992 23:00:12 GMT
  9. Distribution: na
  10. References:  <104398@bu.edu>
  11. Nntp-Posting-Host: chewy.unx.sas.com
  12. Organization: SAS Institute Inc.
  13. Lines: 48
  14.  
  15.  
  16. In article <104398@bu.edu>, apollo@buengc.bu.edu (Doug A. Chan) writes:
  17. |> Is there a simple way to automate a telnet session?
  18. |> By this I mean I'd like to do something like:
  19. |> 
  20. |> csh% telnet < scriptfile >& logoutput
  21. |> 
  22. |> Where 'scriptfile' could contain:
  23. |>  open bigpc   [command to telnet's cli]
  24. |>  joebob       [assuming username next]
  25. |>  mypassword   [user's password]
  26. |>  vt100        [terminal type]
  27. |>  ls -al       [something to do when logged in...]
  28. |>  logout       [exit]
  29. |> 
  30.  
  31. This seems to work over here:
  32.  
  33. ------cut here-------------
  34. #!/bin/csh
  35. echo ""               # Our VM prompts for the user to press <ENTER> to begin
  36. sleep 2               # Oh, just various delays so system isn't overrun
  37. echo logon joebob     # VM needs the command LOGON plus the USERID
  38. sleep 2               # delay
  39. echo joebobpasswd1    # Send over this topsecret password
  40. sleep 5               # Boot baby!!!  Come on, you can do it!   :-)
  41. echo listfile         # Command(s) go here
  42. sleep 2               # dillydally
  43. echo logoff           # Outa here
  44. ------cut here-------------
  45.  
  46. Let's say that was named: "VMlist.csh".  Make it an executable, and
  47. type: 
  48.  
  49.   VMlist.csh | telnet vm >VMlist.log
  50.  
  51. I get a nice log of how the VM session went in VMlist.log.  I guess
  52. you'll want to do manual telnets so you'll know what to each script
  53. needs and guestimating delays or see if you can ignore timing... that's
  54. what I do... maybe it will go away... :-)
  55.  
  56. Anyways....
  57.  
  58.  
  59. -- 
  60. ---Mark C. Burhans---sasmob@chewy.unx.sas.com---919/677-8001 ext 7324
  61. SAS Institute, Inc., USA, SAS Campus Drive, Cary, NC 27513.
  62. "Polygamy:  One wife too many.  Monogamy:  Same idea."  --Unknown???
  63.