From: Christina.Allain@frx.com
Date: Wed Jun 09 2004 - 08:44:35 EDT
All,
The script is now working, Michael DeSimone made the below suggestion:
"The sleep 60 is a Unix command, which you know, but you are at an ftp
prompt and that wont work. What you can do though is go to a shell to do
the sleep. the only thing you would need to change is
sleep 60
to
!sleep 60
I added ! to the sleep and it work like a charm...
For those interested the script look like this now:
#!/bin/sh
ftp -n rest.rest1.com << !EOF
user test 13now
!sleep 60
user forest1 ttree
cd /outbound
hash
prompt
bin
mget call_sample.txt
mget call_detail.txt
mget header.txt
quit
!EOF
Thanks for all those that send me suggestions... I really appreciate all the
efforts
-----Original Message-----
From: Allain, Christina
Sent: Thursday, June 03, 2004 11:53 AM
To: sunmanagers@sunmanagers.org
Subject: AUTOMATED FTP WITH TWO LOGINS
Hello Gurus,
I am writing an automated script that needs to be place in cron job. The
problem with the script is that, I need to log in twice. Does anyone have
similar script? Suggestions are welcome. Thanks in Advance
If I ran the ftp manually it looks like:
ftp -n rest.rest1.com
Connected to rest.rest1.com.
220-FTP authentication :
220
ftp> user test 13now
331-Password:
331
220 narnia FTP server (Version wu-2.6.2+Sun) ready.
ftp> user forestl ttree
331 Password required for forestl.
230 User forestl logged in. Access restrictions apply.
ftp>
When I wrote the script with single user it works fine but with two logins
it failed on the second login. Below is the script:
#!/bin/sh
ftp -n rest.rest1.com << !EOF
user test 13now
sleep 60
user forest1 ttree
cd /outbound
hash
prompt
bin
mget call_sample.txt
mget call_detail.txt
mget header.txt
quit
!EOF
Below is the error from the script:
# ./auto_ftp.scribe.ksh -v
530 Login incorrect.
Login failed.
?Invalid command
Hash mark printing on (8192 bytes/hash mark).
Interactive mode off.
call_sample.txt: No such file or directory.
can't find list of remote files, oops
call_detail.txt: No such file or directory.
can't find list of remote files, oops
header.txt: No such file or directory.
can't find list of remote files, oops
____________________________________________________________________
This e-mail and its attachments may contain Forest Laboratories, Inc.
proprietary information that is privileged, confidential or subject to
copyright belonging to Forest Laboratories, Inc. This e-mail is intended
solely for the use of the individual or entity to which it is addressed. If
you are not the intended recipient of this e-mail, or the employee or agent
responsible for delivering this e-mail to the intended recipient, you are
hereby notified that any dissemination, distribution, copying or action
taken in relation to the contents of and attachments to this e-mail is
strictly prohibited and may be unlawful. If you have received this e-mail in
error, please notify the sender immediately and permanently delete the
original and any copy of this e-mail and any printout.
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:28:49 EDT