Re: [foxboro] ftp script
- From: "Mark Dumond" <mdumond@xxxxxxxxxxxxxx>
- To: <foxboro@xxxxxxxxxxxxx>
- Date: Sun, 21 Jul 2002 14:45:15 -0400
Hey,
The following script will transfer one file via FTP from a command line on
an AW51.
You can easily modify this script for your needs.
Good luck!
Mark Dumond
Senior App Engineer
FeedForward, Inc
Controls Systems Applications
----------------------------------------------------------------------------
-----------------
#!/bin/sh
ERRFILE=./ftp.err
############################################################
# Check for correct number of command line args
############################################################
if [ $# -ne 5 ]
then
echo "Usage:"
echo " ftpFile <host> <userNm> <userPasswd> <localFile>
<RemDir>"
echo
exit 1
fi
# Host, user, passwd and file all explicitly specified as args
HOST="$1"
USER="$2"
PASS="$3"
FILE="$4"
REMDIR="$5"
############################################################
# Ping host to make sure host is reachable
############################################################
ping $HOST > /dev/null
stat=$?
if [ "$stat" -ne 0 ] ; then
echo "Can not Ping Host: $HOST"> $ERRFILE
exit 1
fi
############################################################
# Ftp "put" file to remote host
############################################################
ftp -n $HOST >/tmp/ftpErr.$$ <<EndFTP
ascii
user $USER $PASS
cd $REMDIR
put `basename $FILE`
EndFTP
if [ $? -ne 0 ]
then
echo "ERROR - can not transfer file to $HOST" > $ERRFILE
cat /tmp/ftpErr.$$ >> $ERRFILE
echo >>$ERRFILE
exit 1
fi
rm ftpErr.$$
exit 0
----------------------------------------------------------------------------
---------------
-----Original Message-----
From: foxboro-bounce@xxxxxxxxxxxxx
[mailto:foxboro-bounce@xxxxxxxxxxxxx]On Behalf Of Jriccardi@xxxxxxx
Sent: Saturday, July 20, 2002 9:05 AM
To: foxboro@xxxxxxxxxxxxx
Subject: [foxboro] ftp script
Foxboro Users,
Before I build one from scratch myself, anyone know where I can "borrow" an
existing script to automatically ftp files from an AW51 to a plant network
server. I am hoping to find an existing core script I can modify to fit our
specific application (i.e., IP addresses, paths, etc.) and schedule it with
cron.
What we need is ...
- An AW resident script to ftp numerous files (RBatch Reports) from an
AW directory (LBUG = AW51XX) to a server on the Plant Network (ServerName\I
Drive:\* ).
- I will schedule the script (via cron) to run at 1:00 AM on the 5th of
every month.
- The script will copy all files from the previous month, so it has to
look at date and time.
- Just FYI, there will probably be about 600 files each month.
- Since there are (2) types of file names on the AW (XYZ and ABC RBatch
Report files), and (2) different directories on the Plant Network side
(I:\XYZ\* and I:\ABC\*), I may need (2) separate scripts (I will copy and
edit for the 2nd one); or a way to separate them in a single script before
the ftp (whatever is easiest). The naming convention for the files is -
- MM0001 through MM000X; where MM = the month (01, 02, 03, etc.).
000X = number of the sequential report.
I could not find anything in the Cassandra Project e-mail archive. I would
greatly appreciate any help in getting started.
Joseph M. Riccardi
www.eRiccardi.com
(440)-458-4411 Business
(440)-725-4025 Cell
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
foxboro mailing list: http://www.freelists.org/list/foxboro
to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
foxboro mailing list: http://www.freelists.org/list/foxboro
to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
- References:
- [foxboro] ftp script
- From: Jriccardi
Other related posts:
- » Re: [foxboro] ftp script
- [foxboro] ftp script
- From: Jriccardi