This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

wget tcl

Help for those learning Tcl or writing their own scripts.
Post Reply
p
pinkel
Voice
Posts: 8
Joined: Wed May 21, 2008 2:59 pm

wget tcl

Post by pinkel »

Is it possible to use wget in .tcl?
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

You can execute shell commands using the [exec] Tcl command.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Be advised that exec will block code execution while the command is executed, so downloading large files or accessing slow servers this way may cause your bot to become unresponsive for some time and possibly disconnect from the irc network. You could of course tell wget to run in bg-mode using the -b flag, which would make the exec-command return instantly.

Another way is to use pipes with open, and then user fileevents to read any output from the command.
NML_375
p
pinkel
Voice
Posts: 8
Joined: Wed May 21, 2008 2:59 pm

Post by pinkel »

so someting like this will work?

Code: Select all

[exec wget -O -b /var/www/temp/$filename $url]
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Yes, kind of. Since wget will return immediately, it really won't return anything useful, so I don't see any use for the [].

Edit:
To be abit more clear;

Code: Select all

set somevar [exec wget -b -O /var/www/temp/$filename $url]
This will not produce much interesting information into somevar, and you might just aswell just do like this:

Code: Select all

exec wget -b -O /var/www/temp/$filename $url
NML_375
E
Elfriede
Halfop
Posts: 67
Joined: Tue Aug 07, 2007 4:21 am

Post by Elfriede »

i know an old thread, but how to make that run completely in the background or minimized? can someone please help

Code: Select all

set somevar [exec wget -b -O /var/www/temp/$filename $url]
Post Reply