PDA

View Full Version : Help with external ftp batch script


eger
11-26-2005, 11:36 PM
I have a batch script which rar's up a folder on site and then (attempts) to ftp it to an ftp. I got rar working ok. But the ftp part seems to error with: "ftp: socket". Here is the batch script which is setup for the site command "packi" in ioFTPd.ini:
@ECHO OFF
DEL /F /Q "C:\ioFTPD\scripts\Pack\temp.rar"
"C:\Program Files\WinRAR\rar.exe" a -ep1 -inul -m0 -x"[*Complete]*" -x".*" "C:\ioFTPD\scripts\Pack\temp.rar" "%PATH%\%1"

CD C:\ioFTPD\scripts\Pack

ECHO open xx.xx.xxx.xxx 21>tmpftp
ECHO user>>tmpftp
ECHO fakeuser>>tmpftp
ECHO fakepass>>tmpftp
ECHO cd files>>tmpftp
ECHO binary>>tmpftp
ECHO put temp.rar %1.rar>>tmpftp
ECHO quit>>tmpftp

C:\WINDOWS\system32\ftp.exe -n -s:tmpftp

DEL /F /Q tmpftp
ECHO Done packing %1


%1 is the only argument which is the folder in ioFTPD (ie. site packi This_Is_A_Folder). It creates the rar and tmpftp file. But fails when running the tmpftp script in ftp.exe. If I run C:\WINDOWS\system32\ftp.exe -n -s:tmpftp in a cmd window outside of ioFTPD it works fine. Not sure what's going on here. Is this an IP access issue?

Just wondering what else I can try. There no firewall, NAT, and both machines are on same network. One is ioFTPD and running is running standard ftpd from FreeBSD.

Thanks!

EDIT:

After enabling -d (debug) for ftp.exe I now get "200-Unknown host xx.xx.xxx.xxx." In my FTP client after doing the site command. ANy idea why ioFTPD doesn't think the IP is a real host. But windows cmd.exe does?

eger
11-27-2005, 01:15 AM
Looks like I fixed it. Finally found the magic search which brought up a similar problem witha php script not ocnnecting to mysql (also socket error).

The fix is to make sure the ioftpd.env has:
SYSTEMROOT=%[environment(SYSTEMROOT)]
WINDIR=%[environment(WINDIR)]


Also, I had to kill ioftpd.exe and restart it for the change to take effect. After that the ftp.exe connected just fine and worked as it did in cmd.exe.