[완료] CRT터미널 스크립트(VBS)에서 Ctrl+C 입력 기능을 추가해주고 싶습니다.

자일자일의 이미지

안녕하신지요.

요즘 리눅스를 공부하는학생입니다.

VMWARE로 리눅스 몇개를 설치해놓고 연계해서 시물레이션중인데

지금 하고 싶은것은

항상 /var/log/messages 의 로그를 항상 뛰어 놓고 보고 있습니다.
(tail -f messages)
근데 이곳에 특정 문자, 예로 ABCD99 라는 문자열이 나타나면
CRT에서 'CTRL + C' 로 TAIL을 중지하고

'1234 엔터' 명령을 주고 싶은데요.
1234를 입력해주는것은

crt.Screen.Send "1234" & VbCr 로 해결이 가능한데

TAIL을 중지시킬 수 있는 방법을 모르겠습니다. CTRL+C를 입력할 수 있으면
될거라 생각하는데
어떤방법으로 위의 값을 줄 수 있는지 도움 부탁드립니다.

감사합니다.

ironiris의 이미지

모니터링하는 프로그램이 tail 을 kill 하면 되지 않을까요?

자일자일의 이미지

모니터링용으론 CRT를 사용중이고.

CRT의 스크립트 vbs등의 스크립트를 실행할 수 있는 기능을 이용할생각이며
kill로 죽일 수 없는게..

tail -f messages 로 메시지를 계속 읽다가
특정 문자가 나타나면 죽여줘야 되는데, tail 이 실행중이라 ctrl+C로 중지시키기
전엔 명령어를 줄 수 없다는거지요.

ctrl+c 입력만 crt 스크립트/vbs에서 주는 방법을 알면 스크립트에 해당 구문을 추가하면
tail이 죽을것이고 나머지는 문제없이 처리할 수 있을것 같아요.

▲ 아래의 소스는, 위에서 말한 소스와는 관계가 없으나..
이러한식으로 CRT에서 VBS를 이용해서 시도해보려고합니다.

CRT에서 자동 로그인 스크립트 작성법 (VBScript) 
 
 
 
#$language = "VBScript"
#$interface = "1.0"
 
Sub main
 
  ' turn on synchronous mode so we don't miss any data
  crt.Screen.Synchronous = True
 
  ' Wait for a string that looks like "login: " or "Login: "
  crt.Screen.WaitForString "ogin: "
  crt.Screen.Send "username" & VbCr
  crt.Screen.WaitForString "assword:"
  crt.Screen.Send "password" & VbCr
 
  crt.Screen.Send VbCr
 
  ' prompt the user for a password
  hostnum = crt.Dialog.Prompt("Please enter MMS Server Number(1-6):", "Enter MMS Server Numer", "", False)
 
  If(hostnum = "1") Then
          crt.Screen.Send "telnet xx.xx.xx.xx" & VbCr
  ElseIf(hostnum = "2") Then
          crt.Screen.Send "telnet xx.xx.xx.xx" & VbCr
  ElseIf(hostnum = "3") Then
          crt.Screen.Send "telnet xx.xx.xx.xx" & VbCr
  ElseIf(hostnum = "4") Then
          crt.Screen.Send "telnet xx.xx.xx.xx" & VbCr
  End If 
 
  crt.Screen.WaitForString "ogin: "
  crt.Screen.Send "username" & VbCr
  crt.Screen.WaitForString "assword:"
  crt.Screen.Send "password" & VbCr
 
  ' turn off synchronous mode to restore normal input processing
  crt.Screen.Synchronous = False
 
 
End Sub
자일자일의 이미지

How do I send control characters in a script?

To send or embed control characters in strings in JScript/Javascript convert them to octal values with a prepended '\' character for example:

// send ^C, (decimal 3)
crt.screen.Send("\003")

// send ^D, (decimal 4)
crt.screen.Send("\004")

// send ^M, (decimal 13)
crt.screen.Send("\015")

In VBScript use the Chr() function with the decimal value of the character you want to send:

' Send ^C
crt.screen.Send Chr(3)

' Send ^D
crt.screen.Send Chr(4)

' Send ^M
crt.screen.Send Chr(13)

You can use the VBScript '&' operator to concatenate strings with the Chr() function, for example:

crt.screen.Send "hello" & Chr(10) & "goodbye"

http://www.vandyke.com/support/crt/001.html

CRT 사이트 FAQ에 제가 찾는 내용이 있었네요

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.