sam99
November 15, 2007, 4:28am
1
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
porter
November 15, 2007, 4:33am
2
What are you trying to achieve?
sam99
November 15, 2007, 4:43am
3
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
porter
November 15, 2007, 4:45am
4
what is the sleep for?
what are you using telnet for?
sam99
November 15, 2007, 4:53am
5
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..
porter
November 15, 2007, 4:58am
6
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?
sam99
November 15, 2007, 6:27am
7
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
porter
November 15, 2007, 3:24pm
8
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
porter
November 15, 2007, 3:25pm
9
Have you mispelt "priority"?
sam99
November 16, 2007, 12:12am
10
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
porter
November 16, 2007, 12:23am
11
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 "&".
I'm not talking about retry timeouts at lower protocols.
sam99
November 16, 2007, 1:27am
12
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