- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sftp script
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
тАО08-06-2009 05:00 AM
тАО08-06-2009 05:00 AM
I want to script sftp between two HP-UX servers. The sftp works fine when I issue commands at command line:
sftp USER@HOST
sftp> cd /tmp
sftp> lcd /tmp
sftp> put testfile
sftp> bye
But when I try to script using:
sftp -b /dev/null HOST << EOF
cd /tmp
lcd /tmp
put testfile
quit
EOF
Then there is no error on the terminal or in the remote hosts syslog.log but the file is not transferred.
Any ideas what's wrong with my script? Also, should I rather be using scp or sftp? The existing mechanism on the legacy system is ftp.
Kind Regards
Graham
Solved! Go to Solution.
- Tags:
- sftp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-06-2009 05:07 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-06-2009 05:11 AM
тАО08-06-2009 05:11 AM
Re: sftp script
i would try to find the problem by using
sftp -b USER@HOST -B SCRIPT
SCRIPT contains:
cd /tmp
lcd /tmp
put testfile
quit
Termination on error can be suppressed on a command by command basis by prefixing the command with a "-" character, so change the command line by line and see where the error happens.
f.e.
SCRIPT contains:
-cd /tmp
-lcd /tmp
put testfile
quit
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-06-2009 05:15 AM
тАО08-06-2009 05:15 AM
Re: sftp script
#!/usr/bin/sh
sftp MYHOST << EOF
cd /tmp
lcd /tmp
put testfile
quit
EOF
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-06-2009 05:22 AM
тАО08-06-2009 05:22 AM
Re: sftp script
I am not sure why you have used "-b /dev/null" option. Man page says,
"-b batchfile
Batch mode reads a series of commands from an input batchfile instead of stdin."
But it should work, if your script looks like this,
sftp username@0.0.0.0 <
lcd /path
put filename
EOF
Ganesh.