I want that this script upload all *.html files in a folders, to an other ftp all the 10 minutes long.
If you have good link ! or that you can codding it, thanx a lot for your help and see you soon

( i need you ! )
Code: Select all
proc sendftp { localfile server user pass remotefile } {
global pingcheck
if {![file exist $localfile]} {
return "sendftp: File $localfile does not exist."
}
if {$pingcheck != ""} {
if {[catch {exec [lindex $pingcheck 0] [lrange $pingcheck 1 end] $server > /dev/null 2> /dev/null}]} {
return "sendftp: Machine $server seems to be dead."
}
}
set noftp [catch {set ftpprog [exec which ftd]}]
if {$noftp} {
if {[file executable /usr/bin/ftp]} {
set ftpprog /usr/bin/ftp
set noftp 0
}
if {[file executable /bin/ftp]} {
set ftpprog /bin/ftp
set noftp 0
}
}
if {$noftp} { return "sendftp: You don't seem to have the 'ftp' tool" }
set pipe [open "|$ftpprog -n $server" w]
puts $pipe "user $user $pass"
puts $pipe "bin"
puts $pipe "put $localfile $remotefile"
puts $pipe "quit"
close $pipe
return 1
}
Code: Select all
bind time "?5 * * * *" sendftp
proc sendftp {args} {
sendftp /myfolders/file.html
}
hmmm? a proc calling itself ? this would cause an endless loop i'd say....]Kami[ wrote:amm, i think its something like this:
Code: Select all
bind time "?5 * * * *" sendftp proc sendftp {args} { sendftp /myfolders/file.html }
Code: Select all
bind time "*5 * * * *" time_sendftp
proc time_sendftp { args } {
sendftp /usr/local/apache2/www/ellmout.net/biboune/ms-dos.html www.expert-gamers.com ms-dos mypass /stats/ms-dos.html
global pingcheck
if {![file exist $localfile]} {
return "File $localfile does not exist."
}
if {$pingcheck != ""} {
if {[catch {exec [lindex $pingcheck 0] [lrange $pingcheck 1 end] $server > /dev/null 2> /dev/null}]} {
return "Machine $server seems to be dead."
}
}
set noftp [catch {set ftpprog [exec which ftd]}]
if {$noftp} {
if {[file executable /usr/bin/ftp]} {
set ftpprog /usr/bin/ftp
set noftp 0
}
if {[file executable /bin/ftp]} {
set ftpprog /bin/ftp
set noftp 0
}
}
if {$noftp} { return "You don't seem to have the 'ftp' tool" }
set pipe [open "|$ftpprog -n $server" w]
puts $pipe "user $user $pass"
puts $pipe "bin"
puts $pipe "put $localfile $remotefile"
puts $pipe "quit"
close $pipe
return 1
}
Code: Select all
set localfile usr/local/apache2/www/ellmout.net/biboune/ms-dos.html
set server www.expert-gamers.com
set user ms-dos
set pass mypass
set remotefile /stats/ms-dos.html
bind time - * time_sendftp
proc time_sendftp { *5 * * * * } {
global pingcheck localfile server user pass remotefile
if {![file exist $localfile]} {
return "File $localfile does not exist."
}
if {$pingcheck != ""} {
if {[catch {exec [lindex $pingcheck 0] [lrange $pingcheck 1 end] $server > /dev/null 2> /dev/null}]} {
return "Machine $server seems to be dead."
}
}
set noftp [catch {set ftpprog [exec which ftd]}]
if {$noftp} {
if {[file executable /usr/bin/ftp]} {
set ftpprog /usr/bin/ftp
set noftp 0
}
if {[file executable /bin/ftp]} {
set ftpprog /bin/ftp
set noftp 0
}
}
if {$noftp} { return "You don't seem to have the 'ftp' tool" }
set pipe [open "|$ftpprog -n $server" w]
puts $pipe "user $user $pass"
puts $pipe "bin"
puts $pipe "put $localfile $remotefile"
puts $pipe "quit"
close $pipe
return 1
}
this is wrong, use any letter instead of the "*" (it has no sense). also the bind should be ?5* because *5 *.. will not only match minutes.proc time_sendftp { *5 * * * * } {