• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 278
  • Last Modified:

SCP In Cold Fusion 6?

How to do it?
0
KCarter80
Asked:
KCarter80
  • 3
  • 3
1 Solution
 
SidFishesCommented:
afaik you can't natively

I created a procedure to grab a daily xml file from my site via scp

 what I have done is:

set up cygwin on the windows server and an ssh server
created a ssh user and keyfile
created an ant script to login copy the file via scp and then delete the remote file (s)

<project name="CopyRemoteXML" default="GetFiles" basedir=".">
<echo> ${ant.version}</echo>
&#8722;
      <target name="GetFiles">
<scp trust="true" keyfile="C:\pathtoMyKeyfile\sshKey" toDir="\\server\xml\" passphrase="" file="somelogin@someco.com:/cygdrive/d/somedir/xml/*.xml">
                     
          </scp>
<sshexec host="someco.com" username="somename" trust="true" keyfile="C:\pathtoMyKeyfile\sshKey"
 command="rm /cygdrive/d/somedir/xml/*.xml"/>
</target>
</project>

then I created a vbs script to run the ant script and write a log entry. I added the it to windows task scheduler to run every night

Set ObjWS = WScript.CreateObject("WScript.Shell")
ObjWS.Run ("C:\Eclipse\eclipse\plugins\org.apache.ant_1.6.5\bin\ant -buildfile \\server\scripts\build.xml")


Const FOR_APPENDING = 8
strFileName = "\\server\xml\logs\fetchlog.txt"
strContent  = "Script Ran at:" & Now()  & vbNewLine

Set objFS = CreateObject("Scripting.FileSystemObject")
Set objTS = objFS.OpenTextFile(strFileName,FOR_APPENDING)
objTS.Write strContent


You could run this vbs script via cfexecute or cfschedule
0
 
KCarter80Author Commented:
Any body have any experience doing this on Linux (Redhat ES 3) boxes running CF?
0
 
SidFishesCommented:
that should be even easier(i think)  since scp is native to the OS

something like this perhaps...
<cfexecute
  name = "scp"
  arguments = "somefile.txt username@someplace:somedir/"
  timeout = "6000">
</cfexecute>


0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
KCarter80Author Commented:
This is close to what I need.

However:

I'd like to use CF 6.1 (on a Red Hat server) to SCP a file to a remote host.

CF runs as the nobody user. So I can't set up a key exchange since the nobody user doesn't have the usual directories to put the key in.

Anyone have any thoughts on how to do this?
0
 
SidFishesCommented:
at minimum i'd say paq since my original solution works for windows folks and has value...(not that the original q was specific at all)...as for the points ...whatever
0
 
KCarter80Author Commented:
The windows solution does work in windows. Was never able to find a solution in Linux. Will accept the windows solution.
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now