12-05-2011 11:21 AM
finally I got it to sign to this community and a first question already came up:
I'm trying to transfer a file from SAS 9.3 on Windows via psftp to a Unix-Server.
I've written a dos-bat file "execute_cmd.bat" which contains the following ftp-commands:
When I type in the dos-prompt the following line everything works fine and the file is transferred to the Unix server:
psftp av2 -batch -b d:\test\execute_cmd.bat ("av2" is a stored putty session for connection to the unix server).
When I try to execute this line of code within SAS Enterprise Guide (X commands are enabled):
X "psftp av2 -batch -b d:\test\execute_cmd.bat";
The Program ends fine, without error, but there is no file transferred to the Unix Server.
If I try to execute another .bat file e.g.: "doit.bat" wiht X "d:\test\doit.bat" which contains the following (non ftp) commands it works.
dir > testit.txt
Does anybody have a glue why my transfer isn''t working? I've already searched in google and read lots of related documents but unfortunately without success.
Thanks a lot for your help and kind regards,
12-05-2011 11:52 AM
No idea about psftp, but if you use a PIPE in SAS then you can read the messages that the program might spit out.
filename getfiles pipe "psftp av2 -batch -b d:\test\execute_cmd.bat";
12-05-2011 12:12 PM
I'm confused by what you are saying you are trying to submit. Your command looks like it is trying to run the ftp program and having that program call the batch program.
If your batch program is already calling the ftp program, shouldn't you just be submitting the batch program? And, like Tom suggested, you might want to run the program via a pipe but, again, I think you simply want to run the batch program.
12-05-2011 12:21 PM
The program he listed is a series of FTP command, not DOS commands. He should give it a different extension because the .BAT extension might confuse Windows into think that it is an actual batch of DOS commands.
12-06-2011 05:36 AM
Thanks for the numerous answers.
It seems that it doesn't matter which ending the file containing the FTP commands has.
@Tom: The glue with the pipe is great. Now, I get the follwoing message into the Log:
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 39:95:d4:82:cf:25:8f:92:9a:92:6a:23:4f:89:47:4f
Now, I think I got the solution. I was logged in EG with a different user than the user logged on to the server, because the users usually are not allowed to log-on to the Win-Server. I have a SASADMIN windows user and was logged in Windows with this user. So the keys in the registry are stored under HKEY_CURRENT_USER. But when I use a different user in EG to execute the program the keys are not available to this user.
Any idea how to deal with this issue?
Thanks again for your support!
12-07-2011 09:56 AM
Any suggestions anybody?
Workaround could be to create a user profile for each user on the win-server and configure putty there. so the sessions are strored in the registry for each user and they can use the psftp transfer?
What do you think about this?
12-13-2011 11:34 AM
Does anybody have a auggestion how to deal with this?
Don't you use sftp transfers out of SAS EG for your personalized users or do they work with a common user for which the servers fingerprint is already stored?
Thanks for your collaboration!
12-14-2011 01:38 AM
Here is som examples with sftp. not sure whether it can work with psftp