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.

upload a file using FTP

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
Z
Zeta
Voice
Posts: 16
Joined: Fri Apr 04, 2008 8:52 pm

upload a file using FTP

Post by Zeta »

How can I upload a file with my eggdrop using FTP?
I want to upload a file in a website at 9 o'clock
How can I do that?
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

You could try using the ftp-package available in tcllib:
http://tcllib.sourceforge.net/doc/ftp-docs/
http://sourceforge.net/projects/tcllib/
NML_375
Z
Zeta
Voice
Posts: 16
Joined: Fri Apr 04, 2008 8:52 pm

Post by Zeta »

I'm using this code

Code: Select all

set ftp(host) "host"  
set ftp(user) "user"  
set ftp(pass) "pass" 
set ftp(dir)  "logs"
set ftp(updir) "eggdrop"

bind time - "* 00 * * *" timed:upload
proc timed:upload {m h d m y} {
global ftp

	if {[catch {exec /bin/ping $ftp(host) > /dev/null 2> /dev/null}]} {
		putlog "FTP: Remote server seams to be dead" ; return
	}
	set ftpz [open "/bin/ftp -n $ftp(host)" w]
	puts $ftpz "user $ftp(user) $ftp(pass)"
	puts $ftpz "bin"
	foreach file [lsort [glob -directory $ftp(dir) *]] {
	
		if { [file readable $file] && [file isfile $file]} {
			puts $ftpz "put $file ${$ftp(updir)}/${file}"
		}
	}
	puts $ftpz "quit"
	close $ftpz
	putlog "FTP: all files in $ftp(dir) uploaded successfuly to $ftp(host)"
}
but it doesn't work
it returns "Remote server seams to be dead"

if someone could help it would be appreciated.
r
raider2k
Op
Posts: 140
Joined: Tue Jan 01, 2008 10:42 am

Post by raider2k »

you might want to take a look at lftp
works fine for me in cases of uploading and downloading
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Zeta:
Debugging scripts like that is less than trivial, mainly because it depends on external binaries on the hosting system; /bin/ping and /bin/ftp.
The current use of ping is especially questionable, as most implementations would block your eggdrop for considerably amounts of time. This is also what currently fails in your script. The actual error message(s) and/or return values are discarded however, leaving no clues as to whether the binary (/bin/ping) is actually there and executable, or whether (and why) the ping binary returns an error condition.

The interaction with the ftp binary is poor at best, not checking the response of any issued commands. This would probably be the main reason for the initial ping in the first place.

Also, this script has a poor time-mask, causing it to trigger once every minute 12:00am through 12:59am.
NML_375
Post Reply