Linux.com

Elyas_CR

Elyas_CR

  • Linux.com Member
  • Posts: 1
  • Member Since: 19 Jul 11
  • Last Logged In: 19 Jul 11

Latest Posts

Posted by
Topic
Post Preview
Posted
  • Elyas_CR
    Telnet logging
    Hello everyone. I have a script that telnets into a linux workstation and restarts a service, while logging the session to a file. I'm kind of new to linux so when I was using windows I would capture something like windows cli: telnet xxx.xxx.xxx.xxx -f c:/capture.log ... [me@remote]# /sbin/service dhcpd restart Shutting down dhcpd: OK] Starting dhcpd: OK] Now when using the linux telnet client I capture something like [me@local]# telnet xxx.xxx.xxx.xxx | tee -a /users/me/capture.log ... [me@remote]# /sbin/service dhcpd restart Shutting down dhcpd: [60G[ [0;32mOK[0;39m ] Starting dhcpd: [60G[ [0;32mOK[0;39m ] It looks like the telnet session is passing control characters or something like that to the log file, which messes up some scripts that check whether the service was succesfully restarted. I've already tried playing around with the telnet mode (line vrs char) with no effect. Any ideas on how to get the log with just plain text? Thanks for any advice and sorry if I posted in the wrong place.
    Link to this post 20 Jul 11

    Hello everyone. I have a script that telnets into a linux workstation and restarts a service, while logging the session to a file. I'm kind of new to linux so when I was using windows I would capture something like

    windows cli: telnet xxx.xxx.xxx.xxx -f c:/capture.log
    ...
    [me@remote]# /sbin/service dhcpd restart
    Shutting down dhcpd: OK]
    Starting dhcpd: OK]

    Now when using the linux telnet client I capture something like

    [me@local]# telnet xxx.xxx.xxx.xxx | tee -a /users/me/capture.log
    ...
    [me@remote]# /sbin/service dhcpd restart
    Shutting down dhcpd: [60G[ [0;32mOK[0;39m ]
    Starting dhcpd: [60G[ [0;32mOK[0;39m ]

    It looks like the telnet session is passing control characters or something like that to the log file, which messes up some scripts that check whether the service was succesfully restarted.
    I've already tried playing around with the telnet mode (line vrs char) with no effect. Any ideas on how to get the log with just plain text?

    Thanks for any advice and sorry if I posted in the wrong place.

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board