Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ok I am really lost here

Status
Not open for further replies.

fsanchez13

Technical User
May 9, 2003
35
US
I am trying the following

nohup telnet 10.10.10.10 1003 > /home/myfile &

and everytime I exit it kills the telnet. I thought nohup was suppose to allow me to run a command and then be able to logout without the command being killed? Am I lost on this or just doing someting wrong?
 
Why not use rsh (or remsh or rcmd, depending of your *nix flavor) ?

Hope This Help
PH.
 
telnet is funny like this.....

have you thought of using something like expect to control the telnet session?

Mike

Want to get great answers to your Tek-Tips questions? Have a look at faq219-2884

It's like this; even samurai have teddy bears, and even teddy bears get drunk.
 
I wouldn't begin to know how to use expect for this function. The down and dirty is that I need to create a connection that can stay up for 24hours and log everything that comes across to the machine that is initiating the connection. This also has to be done through cron since the connection needs to establish every morning at midnight and start a new log file. Any clues on how I can do this?
 
Do you have expect installed? If so, try modifying this:

Code:
#!/usr/bin/expect -f

if {$argc==0} {
    send_user "usage: $argv0 host1\n"
    exit
}

set timeout -1
spawn telnet [lindex $argv 0]
match_max 100000
expect -exact "login:"
send -- "userid\r"
expect -exact "assword:"
send -- "password\r"
expect -exact " \$ "
send -- "date\r"
expect -exact " \$ "
send -- "sleep 6\r"
expect -exact " \$ "
send -- "date\r"
expect -exact " \$ "
send -- "exit\r"
expect eof

You should be able to run that safely in the background, redirecting the output to a file. Replace the commands with whatever you need (or delete them if none are required), and replace the " \$ " with a string that matches the command prompt on the remote host.


Annihilannic.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top