- 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-24-2009 05:09 AM
тАО08-24-2009 05:09 AM
I am going to sed a file through SFTP. I have no idea about SFTP. could anyone please send the sample script
Solved! Go to Solution.
- Tags:
- sftp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2009 05:31 AM
тАО08-24-2009 05:31 AM
Re: SFTP Script
You need to setup public keys on your servers to eliminate the need for passwords in scripts. You can use Perl or a pure shell script. In a shell:
# cat .mysftp
HOST=$1
FILE=$2
sftp -b - <
cd /tmp
put -P ${FILE} ${FILE}.backup
EOF
RC=$?
print -u2 "\nSFTP returned ${RC}"
exit ${RC}
...run as;
# ./mysftp somehost somefile
As for the public key setup and more about the Secure Shell in general, see :
http://sial.org/howto/openssh/publickey-auth/
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1254688
These two links should provide you the information you need to easily do this. The 'known_hosts' file contains the public host keys for all known hosts. The per-user version is maintained automatically. Thus, whenever you connect from an unknown host, its key is added to the per-user file if you choose to acknowledge the fingerprint. If you don't, the connection can still be made, but you will be prompted the next time as if you had never connected.
The manpages for 'sshd' and 'ssh' offer more information.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2009 06:09 AM
тАО08-24-2009 06:09 AM
Re: SFTP Script
SFTP is part of a suite of tools that includes ssh, scp.
You really don't need to write an sftp script.
Exchange public keys and use a simple scp command. Works just like rcp.
http://www.hpux.ws/?p=10
SEP
hpuxadmin in gtalk
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2009 11:35 AM
тАО08-24-2009 11:35 AM
Re: SFTP Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2009 04:15 AM
тАО08-25-2009 04:15 AM
Re: SFTP Script
Thanks for your reply.
but I have the following information.
1) I am going to send the file from AlphaVMS(development server) to other side.
2)In our VMS support(admin team) have configured Tectia SSH and provided Public key.
3) what my question is :
Extracted files sent to receiver server thru NDM link, i already written.
$!===========================================================================
$! Transfer file thru NDM
$!===========================================================================
$ type/output=copy_cmds.sql sys$input:
$ deck!======================================================================
drop table tmp_ndm_cmds1
\p\g
create table tmp_ndm_cmds1
as
select num = 1,
cmd = '$ copy/log ie_acctinfo.dat '+e1.value+e2.value+'ie_acctinfo.dat'
from environment e1, environment e2
where e1.name = 'dd_node' and e2.name = 'dd_dir'
\p\g
insert into tmp_ndm_cmds1
select num = 2,
cmd = '$ copy/log nl: '+e1.value+e2.value+'ie_acctinfo.dat_ack'
from environment e1, environment e2
where e1.name = 'dd_node' and e2.name = 'dd_dir'
\p\g
select cmd, num from tmp_ndm_cmds1
order by num
\p\g
drop table tmp_ndm_cmds1
\p\g\q
$ eod!=======================================================================
$ DELETE/log dbout.txt;
$ DELETE/log acctinfo_final.sql;
$ CLOSE outf
$ UNLOCK/LOG ie_acctinfo.dat
$ P = "Client-Account:"
$ SHOW SYMBOL P
$ SHOW SYMBOL COUNT
$!===========================================================================
$! Transfer file thru NDM
$!===========================================================================
$ type/output=copy_cmds.sql sys$input:
$ deck!======================================================================
drop table tmp_ndm_cmds1
\p\g
create table tmp_ndm_cmds1
as
select num = 1,
cmd = '$ copy/log ie_acctinfo.dat '+e1.value+e2.value+'ie_acctinfo.dat'
from environment e1, environment e2
where e1.name = 'dd_node' and e2.name = 'dd_dir'
\p\g
insert into tmp_ndm_cmds1
select num = 2,
cmd = '$ copy/log nl: '+e1.value+e2.value+'ie_acctinfo.dat_ack'
from environment e1, environment e2
where e1.name = 'dd_node' and e2.name = 'dd_dir'
\p\g
select cmd, num from tmp_ndm_cmds1
order by num
\p\g
drop table tmp_ndm_cmds1
\p\g\q
$ eod!=======================================================================
$ sql custody
$ OPEN /WRITE outf1 copy_cmds.con
$ OPEN /READ inf1 copy_cmds.txt
$ loop_cmd:
$ read /end_of_file=cmd_done inf1 line
$ IF (F$EXTRACT(0,2,line) .NES. "|$") then goto loop_cmd
$ second_bar = f$locate("|",F$EXTRACT(1,F$LEN(line)-1,line))
$ lin_out = F$EDIT(F$EXTRACT(1,second_bar,line),"TRIM")
$ WRITE/symbol outf1 lin_out
$ goto loop_cmd
$ cmd_done:
$ close inf1
$ close outf1
$!copy/log ie_acctinfo.dat MEDDEV::NDM_SEND:ie_acctinfo.dat
$!copy/log nl: MEDDEV::NDM_SEND:ie_acctinfo.dat_ack
$@copy_cmds.con
$delete/log copy_cmds.sql;
$delete/log copy_cmds.txt;
$delete/log copy_cmds.con;
$exit
This one i tested from my side thr' NDM.
but now i should send the file thr' SFTP.
I think now you can understand clearly.
please advice and help me.
i really appriciate your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2009 04:21 AM
тАО08-25-2009 04:21 AM
Solution> I am going to send the file from AlphaVMS(development server) to other side.
Then why didn't you post this in the OpenVMS formum?!?
http://forums.itrc.hp.com/service/forums/familyhome.do?familyId=288
Since I don't know anything about VMS I can't comment further except to say you might want to consider a Perl SFTP solution.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2009 04:32 AM
тАО08-25-2009 04:32 AM
Re: SFTP Script
Then where do i post my query and get the answer.
I am new in this forum.
please advice.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2009 07:16 AM
тАО08-25-2009 07:16 AM
Re: SFTP Script
So, "sed" was really "send"? There is a
program named "sed", you know.
> Then where do i post my query and get the
> answer.
How did you find the _wrong_ forum?
http://forums.itrc.hp.com/service/forums/home.do
http://forums.itrc.hp.com/service/forums/familyhome.do?familyId=288
> This one i tested from my side thr' NDM.
What is "NDM"?
Someone may want to analyze your whole
command procedure, but I sure wouldn't. If
your question is, "How do I transfer a file
using SFTP?", then ask that question.
I'd start by trying to get it to work
manually. _Then_ I'd move on to making it
work in a procedure.
> [...] Tectia SSH [...]
_Where_ is this installed?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2009 07:17 AM
тАО08-25-2009 07:17 AM
Re: SFTP Script
> [...] to other side.
What is "other side"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-25-2009 08:25 AM
тАО08-25-2009 08:25 AM
Re: SFTP Script
1) yes, you are right. " i am going to send the file"
2) NDM -- this is also a file transfer protocol
3) " to other side " means other application.
I developed a new file(. com). Usually we trasfer the file through NDM setup.
But this project i have to use SFTP to transfer the file.
They(receiver) have given the "HOST NAME and DIRECTORY/ FOLDER NAME"
I know nothing about SFTP, how I use to transfer the file.
what commands use in file and how I transfer from Alpha server(development environment)
axp>sftp
.. like
could you please guide me.