Tuesday, March 27, 2012

FTP from xp_cmdshell

I have a .bat file that uses ftp -s:scriptname that works from a cmd window
and works from running the .bat file but won't work from xp_cmdshell.
The sql agent proxy is set to a system administrator domain account that is
also an admin on the server. The folder where the files are is shared with
everyone full control. Before FTPing, the files are encrytped using
xp_cmdshell to call and that works fine. I can't figure it out. Can anyone
see what I'm missing? Here is the output from the job with the dashed lines
edited out:
Job 'Test InfoTransfer' : Step 1, 'Encrypt the files' : Began Executing
2006-06-22 15:12:05
output
(null)
C:\WINDOWS\system32>c:\GNUPG\gpg -r securedata --always-trust --yes -o
\\sqldss01\GNUPG\Transfer\6984Test.gpg -e \\sqldss01\c$\PGArchive\6984Test.t
xt
(null)
output
(null)
C:\WINDOWS\system32>c:\GNUPG\gpg -r securedata --always-trust --yes -o
\\sqldss01\GNUPG\Transfer\6985Test.gpg -e
\\sqldss01\c$\PGArchive\6985Test.txt
(null)
output
(null)
C:\WINDOWS\system32>c:\GNUPG\gpg -r securedata --always-trust --yes -o
\\sqldss01\GNUPG\Transfer\6986Test.gpg -e
\\sqldss01\c$\PGArchive\6986Test.txt
(null)
output
(null)
C:\WINDOWS\system32>ftp - s:\\sqldss01\GNUPG\Transfer\pg_ftp_files
Invalid command.
Invalid command.
Not connected.
Not connected.
Not connected.
Not connected.
open ftp.ftp_site_was_here.com
username_was_here
password_was_here
binary
put 6984*.gpg
put 6985*.gpg
put 6986*.gpg
quit
> ftp: connect :Connection refused
(null)
And my ftp script looks like this:
open ftp.ftp_site_was_here.com
username_was_here
password_was_here
binary
put 6984*.gpg
put 6985*.gpg
put 6986*.gpg
quitI forgot. This is SQL Server 2000 SP4 (8.00.2040)
"randy" wrote:

> I have a .bat file that uses ftp -s:scriptname that works from a cmd windo
w
> and works from running the .bat file but won't work from xp_cmdshell.
> The sql agent proxy is set to a system administrator domain account that i
s
> also an admin on the server. The folder where the files are is shared wit
h
> everyone full control. Before FTPing, the files are encrytped using
> xp_cmdshell to call and that works fine. I can't figure it out. Can anyo
ne
> see what I'm missing? Here is the output from the job with the dashed lin
es
> edited out:
> Job 'Test InfoTransfer' : Step 1, 'Encrypt the files' : Began Executing
> 2006-06-22 15:12:05
> output
> (null)
> C:\WINDOWS\system32>c:\GNUPG\gpg -r securedata --always-trust --yes -o
> \\sqldss01\GNUPG\Transfer\6984Test.gpg -e \\sqldss01\c$\PGArchive\6984Test
.txt
> (null)
> output
> (null)
> C:\WINDOWS\system32>c:\GNUPG\gpg -r securedata --always-trust --yes -o
> \\sqldss01\GNUPG\Transfer\6985Test.gpg -e
> \\sqldss01\c$\PGArchive\6985Test.txt
> (null)
> output
> (null)
> C:\WINDOWS\system32>c:\GNUPG\gpg -r securedata --always-trust --yes -o
> \\sqldss01\GNUPG\Transfer\6986Test.gpg -e
> \\sqldss01\c$\PGArchive\6986Test.txt
> (null)
> output
> (null)
> C:\WINDOWS\system32>ftp - s:\\sqldss01\GNUPG\Transfer\pg_ftp_files
> Invalid command.
> Invalid command.
> Not connected.
> Not connected.
> Not connected.
> Not connected.
> open ftp.ftp_site_was_here.com
> username_was_here
> password_was_here
> binary
> put 6984*.gpg
> put 6985*.gpg
> put 6986*.gpg
> quit
> (null)
> And my ftp script looks like this:
> open ftp.ftp_site_was_here.com
> username_was_here
> password_was_here
> binary
> put 6984*.gpg
> put 6985*.gpg
> put 6986*.gpg
> quit

No comments:

Post a Comment