06-07-2005
Error in scripting ftp
Good Morning,
I just would like to know what is wrong with my script. I am trying to use a for loop on my ftp command but the part that pipes the ftp information is reported in unix as error. Here's my script :
#!/bin/ksh
# other parts of the script here....
# get all ORD* files created and then ftp it to the other server...
cd $PRODATA
ORDDOWNLD=`ls ORD????.DLD`
# test data - ORDDOWNLD='ORD8705.DLD ORD8706.DLD ORD8707.DLD'
# then delete e_downso.txt
# Above file is the source of records for ORD files. Once #our system did not find the file "e_downso.txt", it will #generate another ORD file, which is ok because it will not #be part of the list....
# I could also add a logic to rename the ORD* files in the #list variable so that other process running this same script
# will not pick this file again.....
export ORDDOWNLD
for i in $ORDDOWNLD
do
# transfer ORD files one by one......
ftp -n -v wms > josephtest.log <<- !
user test test^M
cd done
put $i
get $i J$i
quit^M
!
# compare if ORD in WMS is equal to what is in GLOVIA...
diff $i J$i
# then test if there is difference,,,if none, then delete $i.....
# else send an email to helpdesk to inform users that part of $i was not copied to WMS...
done
#=================end of script=================================
After running above script, I am getting the following error :
/glo71sw/716/devl/userdata/scripts --> ./josephtest.k>
./josephtest.ksh[7]: syntax error at line 12 : `<<' unmatched
/glo71sw/716/devl/userdata/scripts -->
Please advise. Basically, our goal is to make sure the ORD file we ftp to the other server is the same copy as in our source server. The source of the ORD file is getting updated by many users that is why after getting the list of ORD* files,
Thank you very much!
Joseph
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi quick question from a unix newbie
Working on a project to get me using unix, the point of this project is to find a printer on the network check for jobs in the printer if the printer has no jobs do nothing if the printer has jobs then check the status for errors and e-mail the user. This... (2 Replies)
Discussion started by: w33man
2 Replies
2. Shell Programming and Scripting
I am trying to automate a process in one of two ways:
1) ftp .txt files from a unix server to a Windows 2000 server. I want to do this in a script. Can I supply the login and password to the Windows server inside the script?
2) I tried this and failed: sftp .txt files from the unix server to... (2 Replies)
Discussion started by: gbernard
2 Replies
3. Answers to Frequently Asked Questions
One of our most frequent questions is how to automate ftp transfers. There are several approaches. Since I'm writing this post, we will start with my favorite technique. :)
In Automated FTP task I present a simple example of my ksh co-process technique. And note that later in this thread I... (0 Replies)
Discussion started by: Perderabo
0 Replies
4. Shell Programming and Scripting
Hello,
I'm sure this is an easy one for you UNIX pros. I would like to create and and automated an FTP process. The script should do this:
1. Log into a remote system
2. change to a specified directory
3. copy local files to the remote system
4. quit ftp
5. wait until the next schedule
... (7 Replies)
Discussion started by: bbbngowc
7 Replies
5. Shell Programming and Scripting
Hi guys,
I'm trying to create an ftp script that will read in a value from input, then search for files with the input value, and then ftp the files..
So far I've got my read answer set up, and it'll ls -lrt out my files with the value read answer var I given it...
My question is, what... (14 Replies)
Discussion started by: Jazmania
14 Replies
6. Shell Programming and Scripting
Can some one help with script to track ftp logins on AIX server.. (1 Reply)
Discussion started by: ddk2oo5
1 Replies
7. Shell Programming and Scripting
Hi,
I'm trying to do an FTP script that will read from a list of files and send only the files in that list.
Would this work? Does anyone have anything simpler.
ftp -nv <<EOF
open server
user username password
get $(nawk -F_ -f bbb.awk Filelisting.txt)
EOF (5 Replies)
Discussion started by: bbbngowc
5 Replies
8. Shell Programming and Scripting
Hi,
Please can you tell me the script to transfer file from server A to Server B (1 Reply)
Discussion started by: e1994264
1 Replies
9. Shell Programming and Scripting
Hi Guys,
Good day ULF! I have a general "auto-ftp" code which looks something like this:
#!/bin/sh
cd $1
ftp -v -n $2 << EOF
user $3 $4
prompt
cd $5
bin
mput $6
quit
EOF
This works pretty well, but I'm thinking of how can I make a code by maybe including on this code, for... (5 Replies)
Discussion started by: rymnd_12345
5 Replies
10. UNIX for Dummies Questions & Answers
I dont have enough bits to post in emergency, but I have an urgent FTP issue. A client of ours wants us to pull files from his server onto our server at which point we can process it. I ask a friend what to do, but I was just give the things to do, not how to do it.
I havent written a Unix... (4 Replies)
Discussion started by: MJCreations
4 Replies
FTPD(8) System Manager's Manual FTPD(8)
NAME
ftpd, in.ftpd, setup.anonftp - DARPA Internet File Transfer Protocol server
SYNOPSIS
ftp stream tcp nowait root /usr/sbin/in.ftpd in.ftpd
tcpd ftp /usr/sbin/in.ftpd
DESCRIPTION
Ftpd is the DARPA Internet File Transfer Prototocol server process. The server uses the TCP protocol and listens at the port specified in
the ``ftp'' service specification; see services(5).
The ftp server currently supports the following ftp requests; case is not distinguished.
Request Description
ABOR abort previous command
ACCT specify account (ignored)
ALLO allocate storage (vacuously)
APPE append to a file
CDUP change to parent of current working directory
CWD change working directory
DELE delete a file
HELP give help information
LIST give list files in a directory (``ls -lA'')
MKD make a directory
MODE specify data transfer mode
NLST give name list of files in directory (``ls'')
NOOP do nothing
PASS specify password
PASV prepare for server-to-server transfer
PORT specify data connection port
PWD print the current working directory
QUIT terminate session
RETR retrieve a file
RMD remove a directory
RNFR specify rename-from file name
RNTO specify rename-to file name
STOR store a file
STOU store a file with a unique name
STRU specify data transfer structure
TYPE specify data transfer type
USER specify user name
XCUP change to parent of current working directory
XCWD change working directory
XMKD make a directory
XPWD print the current working directory
XRMD remove a directory
The remaining ftp requests specified in Internet RFC 959 are recognized, but not implemented.
The ftp server will abort an active file transfer only when the ABOR command is preceded by a Telnet "Interrupt Process" (IP) signal and a
Telnet "Synch" signal in the command Telnet stream, as described in Internet RFC 959.
Ftpd interprets file names according to the ``globbing'' conventions used by csh(1). This allows users to utilize the metacharacters
``*?[]{}~''.
Ftpd authenticates users according to three rules.
1) The user name must be in the password data base, /etc/passwd, and not have a null password. In this case a password must be pro-
vided by the client before any file operations may be performed.
2) The user name must not appear in the file /etc/ftpusers.
3) If the user name is ``anonymous'' or ``ftp'', an anonymous ftp account must be present in the password file (user ``ftp''). In this
case the user is allowed to log in by specifying any password (by convention this is given as the client host's name).
In the last case, ftpd takes special measures to restrict the client's access privileges. The server performs a chroot(2) command to the
home directory of the ``ftp'' user. In order that system security is not breached, it is recommended that the ``ftp'' subtree be con-
structed with care; the following rules are recommended.
~ftp) Make the home directory owned by ``ftp'' and unwritable by anyone.
~ftp/bin)
Make this directory owned by the super-user and unwritable by anyone. The program ls(1) must be present to support the list com-
mands. This program should have mode 111.
~ftp/etc)
Make this directory owned by the super-user and unwritable by anyone. The files passwd(5) and group(5) must be present for the ls
command to work properly. These files should be mode 444.
~ftp/pub)
Make this directory mode 755 and owned by the super-user. Create directories in it owned by users if those users want to manage an
anonymous ftp directory.
~ftp/pub/incoming)
Optionally create this directory for anonymous uploads. Make it mode 777. The FTP daemon will create files with mode 266, so
remote users can write a file, but only local users can do something with it.
The script setup.anonftp can be used to create or check an anonymous FTP tree.
SEE ALSO
ftp(1).
BUGS
The anonymous account is inherently dangerous and should avoided when possible.
FTPD(8)