- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: any one has automated shell script to ftp file...
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
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
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
тАО01-26-2007 08:10 AM
тАО01-26-2007 08:10 AM
any one has automated shell script to ftp files across the server?
#!/bin/sh
# FTP Scripts
ftp Dest_Server << LoginId PassWord
lcd /home/LoginId/ftp/
cd /home/LoginId/ftp/
ascii
mput *
quit
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2007 08:18 AM
тАО01-26-2007 08:18 AM
Re: any one has automated shell script to ftp files across the server?
Ideally, you should be using sftp with keys.
Jeff Traigle
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2007 08:26 AM
тАО01-26-2007 08:26 AM
Re: any one has automated shell script to ftp files across the server?
Here is all that is required:
#!/usr/bin/sh
cd /home/LoginId/ftp # local directory
ftpput.pl -h Dest_Server -l username -p topsecret -d /home/LoginId/ftp -A *
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then
echo "Operation Ok"
else
echo "FTP operation failed; status ${STAT}." >&2
fi
Invoke as ftpput.pl -u for full usage --- and you can include a .netrc file so that the password (-p topsecret) argument is not required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2007 07:50 PM
тАО01-26-2007 07:50 PM
Re: any one has automated shell script to ftp files across the server?
$ ftp Dest_Server <
lcd /home/LoginId/ftp/
cd /home/LoginId/ftp/
ascii
prompt
mput *
quit
EOF
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-26-2007 08:11 PM
тАО01-26-2007 08:11 PM
Re: any one has automated shell script to ftp files across the server?
One more way to achieve this
#! /bin/sh
USER="xxxx"
PASS="xxxxxx"
cd "directory which holds the files to be ftped"
ftp -n destinationservername <
quote user $USER
quote pass $PASS
cd "to the destination directory in the destination server"
mput *
HI
You can even write a for loop if you want to copy only specific types of files to be ftped by using find and also delete the files from source once completed using
!command to delete
use "find" to define the file names and pass it to a variable and use the variable in the for loop
example
a=`find . -name "****" -exec ls {} \;`
for i in $a
do
ftp -n destinationserver <
quote user $USER
quote pass $PASS
cd "to the destination directory"
put $i
HI
done
"Happy Scripting"
TQ
Perumal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-29-2007 07:08 AM
тАО01-29-2007 07:08 AM
Re: any one has automated shell script to ftp files across the server?
Thank you all for help.