| SM Ryan 2005-06-29, 7:53 am |
| "smreddy" <srinathmreddy@gmail.com> wrote:
# Hi,
#
# I want to build an windows script which will be check for the status of
# a process running in the unix box?
# Any help will be appricated.
You can run a telnet or ssh server on the unix box and open a socket to it
from the windows machine. You don't need a telnet client, you can create the
socket with Tcl which runs on windows, or perhaps PERL if that runs there,
or a variety of other languages. Telnet clients are easy to make; I'm don't
know how to do the SSL for ssh for that client.
A Tcl telnet client could go something like
set socket [socket serveraddress 23]
fconfigure $socket -buffering line
after 5000
puts $socket username
after 5000
puts $socket password
after 5000
puts $socket {PS1="CLEM CLONE BACK TO SHADOWS AGAIN\n"}
while {![string equal [gets $socket] {CLEM CLONE BACK TO SHADOWS AGAIN}]} {;}
puts $socket "ps -ajx"
set psresponse {}
while 1 {
gets $socket line
if {[string equal $line {CLEM CLONE BACK TO SHADOWS AGAIN}]} break
lappend psresponse $line
}
close $socket
and the lines of the ps -ajx response are in the list $psresponse.
--
SM Ryan http://www.rawbw.com/~wyrmwif/
Title does not dictate behaviour.
|