telnet issue

Hi ,

i am a beginner in AIX.
please find my doubt

I am calling the below script named test_1 by " sh test_1 | telnet "

cmd1="var1=100"

echo open $Infahost
sleep 1
echo $Infaftplogin
sleep 1
echo $Infaftppasswd
sleep 1
echo $cmd1
sleep 5
echo $var1
sleep 5
echo exit

why am i not getting 100 when i am echoing "var1" (echo $var1)
please correct me if i am wrong...

thanks in advance
sam

What are you trying to achieve?

i want to login to a secured file server and copy one folder to another folder. I neeed to provide sleep based on the size of the folder.

i am using slogin to login to the server...

thanks for reply
sam

what is the sleep for?

what are you using telnet for?

1.only a specific user has got access to use slogin to the file server
so we are loging in as that user using telnet...

2.sleep is to provide time delay for copying...( as i understood)
if i provide a small sleep value all files are not copied..

You should not need the sleep.

Personally I would use "ssh" rather than "telnet".

... because you should be doing "echo \$var1" so that the shell expansion happens on the other machine?

when i am using ssh command i facing one error...

please find the command

/usr/local/bin/ssh prtyu@shrif.sundo.com cp -R /bp01/secftp/samsun/prfile/FTP/REFUND_RESTATEMENT_REPORTS/poirty/Production/Internal/'mail rpt' /bp01/secftp/samsun/prfile/FTP/REFUND_RESTATEMENT_REPORTS/poirty/Production/Internal/Archive/

i have to copy the folder 'mail rpt'
i am having spaces in the file name
i ran the same command in the server directly....then it was working fine

please advice
sam

You could pipe in the "cp" command as stdin to the ssh command rather than have it on the command line.

/usr/local/bin/ssh prtyu@shrif.sundo.com <<EOF 
cp -R "/bp01/secftp/samsun/prfile/FTP/REFUND_RESTATEMENT_REPORTS/poirty/Production/Internal/mail rpt" /bp01/secftp/samsun/prfile/FTP/REFUND_RESTATEMENT_REPORTS/poirty/Production/Internal/Archive/
EOF

Have you mispelt "priority"?

thanks for that...i will cross check priority

Could you please tell how to pipe cp with sh

another thing if i am not providing enough sleep it is exiting

thanks again
sam

I did, that is the example with <<EOF ... EOF

No, you shouldn't have to do *any* sleeping. As a general rule if you are doing comms code and you have to have sleeps you have got something wrong(1). Telnet or ssh or rcmd or rsh should not return control until the command at the far end has completed. If you pipe in a thousand commands, they will sit in the pipe line and be diligently executed one at a time in sequence unless you do something fancy with jobs or "&".

  1. I'm not talking about retry timeouts at lower protocols.

please find below the script...
it is not echoing scp_cmd2 and logging out without sleep.....

dir_path=""/bp01/secftp/samsun/prfile/FTP/REFUND_RESTATEMENT_REPORTS/poirty/Production/Internal";

scp_cmd1="/usr/local/bin/ssh -v pushme@bridge.wellpoint.com << EOF"
scp_cmd2="cp -R "$dir_path/mail rpt" $dir_path/Archive"
scp_cmd3="EOF"

echo open $Infahost
sleep 1
echo $Infaftplogin
sleep 1
echo $Infaftppasswd
sleep 1
echo $scp_cmd1
sleep 5
echo $scp_cmd2
sleep 5
echo $scp_cmd3
sleep 5

thanks,
Sam