egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help with sendftp.tcl

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Wed Sep 26, 2007 3:21 am    Post subject: help with sendftp.tcl Reply with quote

have eggdrop 1.6.18

Quote:
bind time - "* * * * *" sendftp

proc sendftp { /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on password /www/madrid/Madrid.html } {
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
}

putlog "SendFTP Loaded"


And this is the error in the Partyline.

Quote:

<(Alaska^> [02:16] Tcl error [sendftp]: can't read "localfile": no such variable
<(Alaska^> [02:17] Tcl error [sendftp]: can't read "localfile": no such variable
<(Alaska^> [02:18] Tcl error [sendftp]: can't read "localfile": no such variable


Can Help me pls ?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
rosc2112
Revered One


Joined: 19 Feb 2006
Posts: 1454
Location: Northeast Pennsylvania

PostPosted: Wed Sep 26, 2007 4:13 am    Post subject: Reply with quote

http://forum.egghelp.org/viewtopic.php?t=10215
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Wed Sep 26, 2007 5:10 am    Post subject: Reply with quote

i can't understand you says.


i do it:

Quote:

<\Nor7on> .set errorinfo 1
<(Alaska^> [04:08] #Nor7on# set errorinfo 1
<(Alaska^> Ok, set.


and now ? how do it

Quote:

when posting code, use code tag, not quote; the code should be indented nicely, making it easier to read and understand, for example use:
Code:

foreach foo $bar {
if {$foo == "moo"} {
#do something
}
}


where do it ?

thxs. Smile
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Wed Sep 26, 2007 5:13 am    Post subject: Reply with quote

opsss, sorry rosc...

Code:

<(Alaska^> [04:11] #Nor7on# set errorInfo
<(Alaska^> Currently: can't read "localfile": no such variable
<(Alaska^> Currently:     while executing
<(Alaska^> Currently: "file exist $localfile"
<(Alaska^> Currently:     (procedure "sendftp" line 3)
<(Alaska^> Currently:     invoked from within
<(Alaska^> Currently: "sendftp $_time1 $_time2 $_time3 $_time4 $_time5"
<(Alaska^> [04:12] Tcl error [sendftp]: can't read "localfile": no such variable


And now ?
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
user
 


Joined: 18 Mar 2003
Posts: 1452
Location: Norway

PostPosted: Wed Sep 26, 2007 7:21 am    Post subject: Re: help with sendftp.tcl Reply with quote

You changed the argument names in the proc instead of passing those arguments to the proc when invoking it. Get a fresh copy of the script (to fix the part you broke), then change your bind to include the required arguments:
Code:
bind time - * {sendftp /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on password /www/madrid/Madrid.html}

_________________
Have you ever read "The Manual"?
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Wed Sep 26, 2007 3:04 pm    Post subject: Reply with quote

Code:

#
# Sendftp v1.01 (12/6/97) by Ernst <baschneo@trick.informatik.uni-stuttgart.de>
# Ernst's eggdrop page:  http://www.sodre.net/ernst/eggdrop/
# =============================================================================

# This is a proc to send a file via FTP to another server. Useful in many
# situations, for example to upload a HTML file generated by eggdrop to your
# www server if it is not the same as your eggdrops machine.

# Change this to something to use to check if a host is alife.
# set pingcheck "" to disable this checking.
# "/bin/ping -c 1" works on Linux. Try just "/bin/ping" on other machines
# Set to "" to disable this checking
set pingcheck "/bin/ping -c 1"

# Include it with 'source scripts/sendftp.tcl'.  Call it with all parameters:
#
#   "sendftp /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on peruclic /www/madrid/Madrid.html"
#
# 'localfile' and 'remotefile' *must* both be given as FULL paths to the
# filenames, the first on the local, the second   on the remote server.
#
# For example:
#
# sendftp /home/bill/stats.htm www.ms.com bill secret /bgates/WWW/stats.htm
#             (local-file       server    user  pass       remote-file)
#


bind time - * {sendftp /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on mypass /www/madrid/Madrid.html}

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
    putlog "\002SendFTP: Archivo's Cargados Correctamente...\002"
   return 1
}

putlog "\002SendFTP Loaded\002"


and, i get this other error.

Code:

<(Alaska^> [14:01] Tcl error [sendftp /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on mypass /www/madrid/Madrid.html]: wrong # args: should be "sendftp localfile server user pass remotefile"
<\Nor7on> .set errorInfo
<(Alaska^> [14:03] #Nor7on# set errorInfo
<(Alaska^> Currently: wrong # args: should be "sendftp localfile server user pass remotefile"
<(Alaska^> Currently:     while executing
<(Alaska^> Currently: "sendftp /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on mypass /www/madrid/Madrid.html $_time1 $_time2 $_time3 $_time4 $_time5"



help me pls Sad thanks.
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Wed Sep 26, 2007 3:13 pm    Post subject: Reply with quote

Did you add the time binding yourself?
_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Wed Sep 26, 2007 4:36 pm    Post subject: Reply with quote

yes, because i want, upload my .html every 5min or 10min.

helpme pls...
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Thu Sep 27, 2007 12:58 pm    Post subject: Reply with quote

Then, I suggest you read the documentation for it..

doc/tcl-commands.doc wrote:
(37) TIME (stackable)
bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>

Description: allows you to schedule procedure calls at certain
times. mask matches 5 space separated integers of the form:
"minute hour day month year". minute, hour, day, month have a
zero padding so they are exactly two characters long; year is
four characters. Flags are ignored.
Module: core

This means, that 5 arguments are added to your commandline, and hence the proc you call must be written to handle it.

Simplest would probably be to create a new proc with the sole purpose of executing "sendftp /home/stats.htm ......", and trigger it using the binding...

Code:
bind time - "*0 * * * *" sendmyfile
proc sendmyfile {min hour day month year} {
 sendftp "/home/nor7on/www/madrid/Madrid.html" "www.aikidoestrac.org" "nor7on" "mypass" "/www/madrid/Madrid.html"
}

_________________
NML_375, idling at #eggdrop@IrcNET
Back to top
View user's profile Send private message
Nor7on
Op


Joined: 03 Mar 2007
Posts: 185
Location: Spain - Barcelona

PostPosted: Tue Oct 02, 2007 10:16 am    Post subject: Reply with quote

its done, but don't transfer files.

Code:

#
# Sendftp v1.01 (12/6/97) by Ernst <baschneo@trick.informatik.uni-stuttgart.de>
# Ernst's eggdrop page:  http://www.sodre.net/ernst/eggdrop/
# =============================================================================

# This is a proc to send a file via FTP to another server. Useful in many
# situations, for example to upload a HTML file generated by eggdrop to your
# www server if it is not the same as your eggdrops machine.

# Change this to something to use to check if a host is alife.
# set pingcheck "" to disable this checking.
# "/bin/ping -c 1" works on Linux. Try just "/bin/ping" on other machines
# Set to "" to disable this checking
set pingcheck "/bin/ping -c 1"

# Include it with 'source scripts/sendftp.tcl'.  Call it with all parameters:
#
#   "sendftp /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on pass /www/madrid/Madrid.html"
#
# 'localfile' and 'remotefile' *must* both be given as FULL paths to the
# filenames, the first on the local, the second   on the remote server.
#
# For example:
#
# sendftp /home/bill/stats.htm www.ms.com bill secret /bgates/WWW/stats.htm
#             (local-file       server    user  pass       remote-file)
#

bind time - "*0 * * * *" sendmyfile
proc sendmyfile {min hour day month year} {
 sendftp /home/nor7on/www/madrid/Madrid.html www.aikidoestrac.org nor7on pass /www/madrid/Madrid.html
}

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
    putlog "\002SendFTP: Archivo's Cargados Correctamente...\002"
   return 1
}

putlog "\002SendFTP Loaded\002"


=/
Back to top
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber