Execute Loop in Telnet


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execute Loop in Telnet
# 1  
Old 07-23-2007
CPU & Memory Execute Loop in Telnet

hi Everyone , have a nice day

HTML Code:
#!/bin/sh
( sleep 1
 echo "LOGIN:username:password;"
 sleep 1 
 while IFS= read -r line
 do
 #echo $line
 GET:VOUCHERDETAIL:VoucherSerialNumber,$line; >> /home/status_log
 done < /home/status.txt
 sleep 1
 echo "LOGOUT;") | telnet 127.0.0.1 7021
,

it throws the following output

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
RESP:0;
./voucher1.sh: -r: is not an identifier
Connection to 127.0.0.1 closed by foreign host.

help will be appreciated
Regards and Waiting
# 2  
Old 07-23-2007
Well debugged it a little though

HTML Code:
#!/bin/sh
echo "Input file Name: "
read file


( sleep 1
 echo "LOGIN:user:password;";
 sleep 1
cat $file | while read LINE
do 
 echo "GET:VOUCHERDETAIL:VoucherSerialNumber,$LINE;";
 sleep 1 
done</home/$file
 sleep 1 
 echo "LOGOUT;") | telnet 127.0.0.1 7021
above code is working fine but its giving me all output on command line , i want output to go in a file , how can i do thatSmilie

Regards
# 3  
Old 07-24-2007
no one Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Telnet connection closes before i execute GET command

I tried the below steps for telnet command from a remote server: 1. telnet myservice.com 443 2. GET / HTTP/1.0 3. Press enter key twice Please see the output below: bash-3.2$ hostname remoteserver1 bash-3.2$ telnet myservice.com 443 Trying 191.172.172.133... Connected to... (7 Replies)
Discussion started by: mohtashims
7 Replies

2. Shell Programming and Scripting

How to execute telnet commands thru xterm?

I want to launch an xterm telnet window: xterm -e telnet xxx.xxx.xx.xxx Which I can do but needs to also launch commands as well. Please use CODE tags as required by forum rules! (2 Replies)
Discussion started by: shopgirl08
2 Replies

3. Shell Programming and Scripting

Telnet using port and execute cmd

Hi, my query is: I am Login on server with IP xxx.xxx.xxx.xxx.. and i want a script where i want to telnet to server with IP yyy.yyy.yyy.yyy using specific port and then execute a cmd there on server Y please suggest (1 Reply)
Discussion started by: dodasajan
1 Replies

4. Shell Programming and Scripting

Execute command with loop

I have a below command ALTER TABLE `abc` ADD PARTITION ( PARTITION 20130613 VALUES less than (DAY('13'))); Below is requirement It runs in Loop as DAY start with 13 and end with 100 along with this of counter "20130613" also increases per command as the next command should be ... (8 Replies)
Discussion started by: kaushik02018
8 Replies

5. Shell Programming and Scripting

how do i execute a set of commands in telnet??

I have list of commands in a file in one sever and i need to execute these set of commands in the server to which i m telnetting to .. (4 Replies)
Discussion started by: nikhil jain
4 Replies

6. Shell Programming and Scripting

expect telnet script execute by cronjob

hi, please help, keep getting this bolded error and look it up and people say its your environment variable though i tried to set it manually in expect..it run fine if i run it manually but once i run it by cronjob it error below..i tried to comment out ip/login info with *.. logfile:: START... (0 Replies)
Discussion started by: cssanangeles
0 Replies

7. Shell Programming and Scripting

Telnet to router and execute command

I am trying to write a shell script to execute some commands.. telnet <IP address of the router> wait 10 echo "username" echo "password" sh log exit but i am unable to execute it properly ..please help me .. thanks in advance Sri (1 Reply)
Discussion started by: srikanthus2002
1 Replies

8. UNIX for Dummies Questions & Answers

Only execute telnet and ping for user

Hello for all! This is the situation: I must create many users that only can execute telnet and ping. Create users is not a problem, but I donīt know how limit the users privileges, to only execute telnet and ping. I hope you can help me. Thank's for all. Bye :) PD: Sorry for my... (4 Replies)
Discussion started by: bobbasystem
4 Replies

9. UNIX for Advanced & Expert Users

Execute while loop

Hi, I have a background process running for which I want to know the status continuously. I want to execute a WHILE loop in the command prompt so that it keeps on displaying in the screen.But, I am getting the following errors :- hyper20:~ 3> while while? while? hyper20:~ 4> while {1}... (7 Replies)
Discussion started by: shubhranshu
7 Replies

10. Shell Programming and Scripting

Execute scripts from remote using telnet

Hi having the below code (sleep 1 echo "username" sleep 2 echo "password" sleep 2 echo "cd /home/test1/path" sleep 10 echo "ls -l | grep filename" if exists echo "script1.sh filename" echo "mailx -s "Task Executed" user@domain.com" else echo "mailx -s "File not Exist"... (1 Reply)
Discussion started by: karthikn7974
1 Replies
Login or Register to Ask a Question