PDA

View Full Version : [Filled] site urlget <link> script


Janus
04-01-2004, 12:29 PM
*********************************************

hi folks


is there a script available, which has this site command feature


site urlget <link>


dls direktly ftp/http files into your current command diretory


i know raiden is crap,but this wasn´t so bad at all


cheers janus

Mouton
04-01-2004, 01:53 PM
sound like wget to me...
find wget for windows, and create a ftp_custom_command for it...
Somehting like:
getrurl = EXEC ..\scripts\wget.exe

then hop u go...
site geturl http://www.ioftpd.com/index.php

mr_F_2
04-01-2004, 04:31 PM
i wrote a simple batch file for this, in hopes of sharing it, but stumbled across something that puzzled me

in ioFTPD.ini:
urlget = %EXEC ..\scripts\urlget\urlget.bat "%[$path]"

code is

@echo off
if %2.==. goto showsyntax

echo FOR TESTING ::: ..\scripts\urlget\wget.exe --tries=3 --directory-prefix=%1 --timeout=30 --waitretry=5 -nd %2
..\scripts\urlget\wget.exe --tries=3 --directory-prefix=%1 --timeout=30 --waitretry=5 -nd %2
goto end

:showsyntax
echo ---[site urlget help]--------------
echo usage: site urlget url
echo example: site urlget www.yahoo.com
echo -----------------------------------
goto end

:end

called from ..\ioftpd\system, the command sent is:
site urlget www.yahoo.com
sends params:

..\scripts\urlget\wget.exe --tries=3 --directory-prefix="F:\current\ftpd\path" --timeout=30 --waitretry=5 -nd "www.yahoo.com"

strangely enough though, wget fails. however, if I i load cmd to ..\ioftpd\system and call "..\scripts\urlget\wget.exe --tries=3 --directory-prefix=%1 --timeout=30 --waitretry=5 -nd %2
" manually wget succeeds. something is impeding wget from resolving the host when called from ioFTPD, but I don't see why?

any idea's anybody?

Mouton
04-01-2004, 04:49 PM
Using your exact batch file:

[16:47:29] [L] site urlget www.yahoo.com
[16:47:29] [L] 200-FOR TESTING ::: ..\scripts\urlget\wget.exe --tries=3 --directory-prefix="d:\ioftpd\site\" --timeout=30 --waitretry=5 -nd www.yahoo.com

mr_F_2
04-01-2004, 05:01 PM
oh sorry, i accently edited out a line while i was making it "post-worthy" right after that echo line which you quoted is the actual parameter execution line.

giving...

[L] site urlget www.yahoo.com
[L] 200-..\scripts\urlget\wget.exe --tries=3 --directory-prefix="c:\ioFTPD\site" --timeout=30 --waitretry=5 -nd www.yahoo.com
[L] 200---16:02:03-- http://www.yahoo.com/
[L] 200- => `c:/ioFTPD/site/index.html.1'
[L] 200-Resolving www.yahoo.com... failed: Host not found.


at CMD prompt:
C:\ioFTPD\system>..\scripts\urlget\wget.exe --tries=3 --directory-prefix="c:\ioF
TPD\site" --timeout=30 --waitretry=5 -nd www.yahoo.com
--16:03:11-- http://www.yahoo.com/
=> `c:/ioFTPD/site/index.html.1'
Resolving www.yahoo.com... 66.94.230.39, 66.94.230.44, 66.94.230.46, ...
Connecting to www.yahoo.com[66.94.230.39]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]

[ <=> ] 33,285 57.94K/s

16:03:12 (57.94 KB/s) - `c:/ioFTPD/site/index.html.1' saved [33285]

Mouton
04-01-2004, 05:20 PM
Missing env vars:

http://www.ioftpd.com/kb/view.php?kbid=67

Janus
04-01-2004, 06:16 PM
*******************

seems you come to an end

Mr F can you rewrite the correct .bat-code in quote for copying it:
what version of wget do you use

ok error is in my code for sure:


anyway many thx for your help


J@nus

mr_F_2
04-01-2004, 06:36 PM
thanks mouton, strange how that effected it


save this to urlget.bat

@echo off
if %2.==. goto showsyntax

echo !detach 0
..\scripts\urlget\wget.exe --quiet --tries=3 --directory-prefix=%1 --timeout=30 --waitretry=5 -nd %2

:showsyntax
echo ---[site urlget help]--------------
echo usage: site urlget url
echo example: site urlget www.yahoo.com
echo -----------------------------------
goto end

:end


in ioFTPD.ini:
urlget = %EXEC ..\scripts\path\to\urlget.bat "%[$path]"
and
urlget = !A *
(or whatever perms you wanna give it)

and as mentioned by mouton, make sure these 2 lines are in your ioftpd.env:
SYSTEMROOT=%[environment(SYSTEMROOT)]
WINDIR=%[environment(WINDIR)]

... restart io. note: you need wget.exe to be in the same directory as this batch file. also note that there is no CUI output after the process detaches from IO. this is so if you are downloading a large file with urlget you can still move about the ftp... obviously you can edit the code if you don't like it that way.

i use WGet 1.9.1 BTW, get wget here (http://www.gnu.org/directory/wget.html)

Janus
04-01-2004, 06:48 PM
*************************************

works !!!!


cool community

thx MrF & mouton

NorLan
04-02-2004, 12:05 PM
hehe so i finally see where you get it janus*g

thx mounton an MrF

Janus
04-06-2004, 06:20 AM
************************************************

Mr F

maybe time for some tuning?

1.no messages in log appear that process is running
2. during dl this login is completely blocked, you can´t do some other server operations...maybe process can be cut off

cheers optixxx

Mouton
04-06-2004, 07:44 AM
1. Add echo !putlog something_u_want_to_see_in_ioftpd_log at the start of the script... it will be written in ioFTPD.log
2. Try changing echo detach 1 to echo !detach 0

mr_F_2
04-06-2004, 10:59 AM
Originally posted by Mouton

2. Try changing echo detach 1 to echo !detach 0

i don't know why i posted !detach 1, i even had !detach 0 in my file...

Mouton
04-06-2004, 12:14 PM
echo !detach
not
echo detach

Janus
04-06-2004, 05:32 PM
*******************************************

yes nice.works...process is cut off


sorry...urgs,my english.....i meat not .log, i wonna have a notice in status windows


some like:

blabla is retrieving your ordered file!

at end
blabla successfully downloaded


something like that

mr_F_2
04-06-2004, 05:58 PM
are you joking?
the source code is right there, edit it yourself

IE:
instead of the line
echo !detach 0
put
echo downloading file
and after the wget line put
echo download complete

but your user won't be able to do anything while wget is downloading file, hence the !detach. detached process' cannot output to io

Janus
04-07-2004, 04:00 AM
***********************************

no joke,no kokain :)


now i understand,both can´t be done (cut off+ status msges).

I will take one choise


Anyway thx Mr_F and keep up your good work here