- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: FTP Scripts
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2002 10:50 PM
тАО09-09-2002 10:50 PM
FTP Scripts
#!/usr/bin/sh
{ echo "open ServerB
user user pass
hash
cd /directory/
mget *
close"
} | ftp -i -n -v 2>&1 | tee /tmp/ftplog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2002 11:17 PM
тАО09-09-2002 11:17 PM
Re: FTP Scripts
Here is a script for you.
#!/bin/ksh
if [ ! -f filename.txt ]
then
cp /dev/null filename.txt
fi
mv filename.txt filename.prev
ftp -n
user
cd
nlist
quit
EOF
comm -23 filename.curr filename.prev > filename.diff
for i in `cat filename.diff`
do
ftp -n
cd
get $i
quit
EOF
done
This is just a simple script but it works (I have try it). You can further enhance it to fulfill your requirement !
Regards,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2002 11:20 PM
тАО09-09-2002 11:20 PM
Re: FTP Scripts
Before you start the ftp you will have to extend your script to do an ls -l on the dir, sending the output to a file.
E.G.
ls -l | awk @{print $9}' > /tmp/ftplist
Each time you do an ftp compare it with this file and if there are new files then ftp them, The script should then update it if there are new files, so that at next run time these files do not get sent again.
HTH
Paula
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-09-2002 11:29 PM
тАО09-09-2002 11:29 PM
Re: FTP Scripts
Sorry about that ! I've forgotten to rename the file after the testing.
By the way, your have to replace the 'filename.txt' with 'filename.curr'
Regards,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 09:17 PM
тАО09-10-2002 09:17 PM
Re: FTP Scripts
everything looks nice especially the latest reply. But there is little weakness. Use -lL. The "L" looks for links. And I have a question:
why don't u use PERL?? If u do the last reply, you will run into trouble with awk. Awk (and sed) is restricted to 3000 values to be processed and about this number it will go unpredictible. I experienced this very fact and have been using PERL exclusively since.
The algorithm could look alike.
(:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 10:55 PM
тАО09-10-2002 10:55 PM
Re: FTP Scripts
Patrick, the comm command after the first ftp doesn't seem to be executed. Any idea why?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2002 08:10 PM
тАО09-11-2002 08:10 PM
Re: FTP Scripts
Sorry for the late reply as I cannot login to the forum this morning as it show 'services unavailable'.
BTW, what error did you get ?
Did you submit the job by cron ? If so, you have to specific the full path of comm, i.e. /usr/bin/comm
Regards,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-11-2002 11:17 PM
тАО09-11-2002 11:17 PM
Re: FTP Scripts
Thanks for the response.
I ran the complete script from the command line and it gave the folliwng error :-
cat: Cannot open tempfile.diff: No such file or directory
tempfile.diff doesn't seem to be created by comm. But if I run the full comm command manully from cmd line it works fine.
I forced it run as /usr/bin/ksh and /usr/bin/sh but nothing works.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2002 12:48 AM
тАО09-12-2002 12:48 AM
Re: FTP Scripts
Can you attach the script so that I can have a look ??
Does the file tempfile.diff create by you or other ? Do you have write permission on it ? How about if you specific all file with absolute path ?
Regards,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2002 06:41 AM
тАО09-12-2002 06:41 AM
Re: FTP Scripts
#!/usr/bin/ksh
#set -x
cd /testdata/temp_data/test
if [ ! -f tempfile.curr ]
then
cp /dev/null tempfile.curr
fi
mv tempfile.curr tempfile.prev
ftp -n -v -i machineB << EOF > tempfile.curr
user login password
cd /IN/TEMP/
nlist c*
close
quit
EOF
/usr/bin/ksh comm -23 tempfile.curr tempfile.prev > tempfile.diff
for i in `cat tempfile.diff`
do
ftp -n machineB << EOF
user login password
cd /IN/TEMP/
get $i
quit
EOF
done