- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Simple Automated 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
Forums
Discussions
Discussions
Discussions
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
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
03-12-2001 01:53 PM
03-12-2001 01:53 PM
Simple Automated FTP Scripts
I am new to Unix scripting, and I admit this is above my abilities (I am an expert from the NT world). However, I am capable of modifying any current script to work.
I am humbly hoping there is a current good script out there or a good utility to accomplish this task.
Thanks Everyone.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2001 06:53 PM
03-12-2001 06:53 PM
Re: Simple Automated FTP Scripts
For an unsecure implementation, use a combination of remsh and rcp.
For a secure implementation, use a combination of ssh and scp.
You can remote shell to your server to execute the shell script. In the shell script, perform the necessary checks using [ -e filename ]. To check if the file is complete, use lsof to check if the file has stopped being written into. Subsequently perform remote copy to copy the file back to your client.
Hope this helps. Regards.
Steven Sim Kok Leong
Brainbench MVP for Unix Admin
http://www.brainbench.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2001 11:36 PM
03-12-2001 11:36 PM
Re: Simple Automated FTP Scripts
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xffe5f841489fd4118fef0090279cd0f9,00.html
To run it daily you could use "cron".
Look at the manpages for "test" to find out how to check for if the file exists.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2001 09:14 AM
03-13-2001 09:14 AM
Re: Simple Automated FTP Scripts
To get a remote file:
ftp_copy_file.sh user
To push a local file to a remote host:
ftp_copy_file.sh user
#!/bin/ksh
function usage {
print "Usage: $APP_NAME
}
function ftp_get_remote_file {
ftp -i -n $REMOTE_HOST <
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2001 09:32 AM
03-13-2001 09:32 AM
Re: Simple Automated FTP Scripts
As the purpose of the forums is not to have people work for you for free!, It may be worth a consulting call to accomplish "EXACTLY" what you need!!!
I have at sites setup a mixture of scripts and cron jobs to do what you need, but these are very specific. Some encrypt data, some make tarballs of lots of data, some compress but all move data from site to site.
Some ideas were mentioned about using ssh, and scp for secure connections, and lsof to check for open files. remember that lsof, and ssh are NOT included with HP-UX so you must install them on your own!
The easiest way to do what you need, but very insecure is to use a $HOME/.netrc file, and create a user for this job. Give them access to run a cron job, and schedule as that user a cron job which is "/usr/bin/ftp $dest". the .netrc file allows you to create a macro called init which is automatically executed at each host ftp's to. Using this method, the data could be transferred.
there is a large problem with you not owning the vendors server though, and that is how will you control the test to see if the file is complete? This must be executed on the vendors server!
Some easy ref's for you would be...
man netrc
man cron
man ftp
Regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2001 09:44 AM
03-13-2001 09:44 AM
Re: Simple Automated FTP Scripts
You posted this yesterday at least twice. I offered you a reply in this thread (named differently than this one, but containing the same query:
http://forums.itrc.hp.com/cm/QuestionAnswer/1,1150,0xfb7adfe5920fd5118fef0090279cd0f9,00.html
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-13-2001 09:48 AM
03-13-2001 09:48 AM
Re: Simple Automated FTP Scripts
Well, that's NT thinking I guess. Press Okay, Press "Yes", Press "Yes", Press "Yes", Press "Yes" and then perform the task! LOL
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2001 04:51 AM
09-28-2001 04:51 AM
Re: Simple Automated FTP Scripts
If you use .netrc with "macdef init" for the whole automation you do limit yourself. You can only have one FTP session going at a time.
If you use input redirection (using here statements (<<-EOF) or simply echoing a bunch of commands into | ftp -iv $REMHOST, then you compromise security by having unencrypted IDs and passwords.
Here is what I have been using:
Use the .netrc to automate the log on. You can have multiple remote hosts in the .netrc, and it hides the log on info.
You can then use input redirection to script the remaining commands. This allows you to have multiple FTP sessions to multiple remote hosts without fear of conflict.
The only downside is that FTP doesn't give non zero return codes if any of the commands fail. You can try using a Korn shell co-process to give you greater interaction with the FTP session. I've attached my first attempt at it if you are interested. (Ignore the stdlistfile command - that is something else I use for handling Maestro.)
Hope that helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-28-2001 05:08 AM
09-28-2001 05:08 AM
Re: Simple Automated FTP Scripts
When I have to do ftp scripting nowadays, I use perl with the Net::FTP module (available for download at www.perl.org/CPAN). It really makes FTP operations very simple. Any error conditions and timeouts are easy to test for and set. The other advantage is that unlike shell script based solutions, your perl scripts can run unchanged on NT and W2K boxes if you install the freely available product ActivePerl (www.activeperl.com) .
It's usually something as simple as this (with error checking omitted):
use Net::FTP;
$ftp = Net::FTP->new("remhost.xxx.yyy", Debug => 0);
$ftp->login("anonymous",'cstephen@mama.com');
$ftp->cwd("/Downloads");
$ftp->get("Testfile.TXT");
$ftp->quit;
Regards, Clay