It works this way: if in my pub cmd bot find word -get he download file from $wwwlink using wget and after that send it to me using dccsend command.
But when bot begin dccsend the file from wget didnt already downloaded.
How can I scan if wget command is successfully finished and only after that begin dccsend to me?
Thank you.
For starters, your [exec...] line will most certainly cause an error, and nothing else will be processed after that.
You only use []'s around a command when you are setting a variable and/or doing something with the results of that command. Remove the []'s around your exec line. Secondly, since you are not launching wget into the background, exec will not return control back to the script until wget completes. This by itself will accomplish what you ask of, however it can also cause your bot to timeout if the download is a long one.
switch -- [dccsend /home/bots/mybot/scripts/files/$unick/$filename $unick] {
0 {
puthelp "NOTICE $unick :sending $filename to you."
dccsend /home/bots/mybot/scripts/files/$unick/$filename $unick
}
1 { puthelp "NOTICE $unick :dcc table is full (too many connections), try to get $filename later." }
2 { puthelp "NOTICE $unick :can't open a socket for the transfer of $filename." }
3 { puthelp "NOTICE $unick :$filename doesn't exist." }
4 { puthelp "NOTICE $unick :$filename was queued for later transfer." }
}
## dcc sends/recieves por Marco Ferra aka nXistence
Now you are using -b with wget to cause wget to return right away, meaning the script will continue on immediately WHILE wget downloads the file. You will need to remove the -b switch. Alternatively to exec, you can use open with the |, or use a script that already does this, such as bgexec.tcl which will execute a command in non-blocking mode, and then call a procedure once the command has completed.
Yes, because you are not using the -b flag with wget, which you could have done with exec as well. However, you will most likely get incomplete dccsends, especially if the download host is slower than the bot's dcc transfer, since you are not waiting for the download to finish before sending.