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.

ftp-send kills script(?) [solved]

Help for those learning Tcl or writing their own scripts.
Post Reply
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

ftp-send kills script(?) [solved]

Post by cannot_delete »

Hi,

if I add this:

Code: Select all

[exec /usr/bin/ncftpput -f ./scripts/ftpserver.ftp /Allstars/ ./scripts/moxquizz/quizdata/rankallstars.data]
to my MoxQuiz-Script (or any other script) the script stops. It does send the rankallstars.data though.

Same thing with this timer-command:

Code: Select all

bind time - "10 * * * *" 
It only sends once. 10 min. later nothing happens.

If i bind it to a "!send"-command it works.



Thx for your help,

-typ-
Last edited by cannot_delete on Sun Jan 28, 2007 8:03 pm, edited 1 time in total.
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Post by cannot_delete »

Pls, anyone help me. =)

It doesn't need to be this code. I just need something that sends this file every 24h by ftp.

Thx,

-typ-
User avatar
Alchera
Revered One
Posts: 3344
Joined: Mon Aug 11, 2003 12:42 pm
Location: Ballarat Victoria, Australia
Contact:

Post by Alchera »

It would stop because you're not logging into a user account and sending a pass?

It's possible this post is what you need to read; do it via a bash script (with crontab) instead.

The code in the last post will require a little editing to have it do what you want but I think you'll get the idea of how it is supposed to work.

There's also sendftp.tcl.
Add [SOLVED] to the thread title if your issue has been.
Search | FAQ | RTM
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Post by cannot_delete »

Hi,

thx for your help. I#m not sure if I understood your first question right. But my user-account data and pass are saved in the "ftpserver.ftp" mentioned here:

[exec /usr/bin/ncftpput -f ./scripts/ftpserver.ftp /Allstars/ ./scripts/moxquizz/quizdata/rankallstars.data]

The bot executes this line (successfully send the rankallstars.data to my ftp-account), but stops afterwards. I added another line witch should send another file, but the bot doesn't.

Unfortunally I am not able to use contrab.

Concerning the sendftp.tcl I added:

Code: Select all

set ftpserv "moxquizz/scripts/logzipper.txt moxquiz.mo.funpic.de moxquiz mypass /logs/logzipper.txt"
bind pub - !logs sendftp §ftpserv

set pingcheck ""

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
}
But i get the following error:
[15:01] wrong # args: should be "bind type flags cmd/mask ?procname?"
while executing
"bind pub - !logs sendftp §ftpserv"
(file "scripts/mowlgiggle.tcl" line 57)
invoked from within
"source scripts/mowlgiggle.tcl"
(file "eggdrop.conf" line 132)
[15:01] * CONFIG FILE NOT LOADED (NOT FOUND, OR ERROR)
I suppose that means my §ftpserv isn't in the right place. but where to put it?

thx for your help,

-typ-
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

PUB
bind pub <flags> <command> <proc>
procname <nick> <user@host> <handle> <channel> <text>

Description: used for commands given on a channel. The first word
becomes the command and everything else is the text argument.
Module: irc
As for freezing after [exec], try use [open "|<command>"] instead (Search the forum for examples).
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Because bind doesn't work in the way you try to use it, nor does it have the capability to use that character as a variable.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@-typ:
As indicated by Sir_Fz's post, the command executed when the binding triggers would be "procname <nick> <user@host> <handle> <channel> <text>", hence you'll have to create your sendftp-proc such that it accepts those arguments accordingly. Also, should you desire to supply additional arguments, you'd have to do it something like this:

Code: Select all

bind pub - !command [list proc $myvar]
Also, you would have to alter your proc accordingly to accept the additional argument, making the argument-list "<myvar> <nick> <user@host> <handle> <channel> <text>".
There is however, much easier ways of doing what I think you wish to accomplish, such as accessing globalspace variables from within your proc (see manpage for "global").
NML_375
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Post by cannot_delete »

Hi,

first: thx for all your help.

I tried implementing the "[open "|<command>"] "-Command because that seemed to be the simplest solution for my problem. Unfortunally I am still searching the forum for an example.

I'll keep you postet.^^


-typ-
c
cannot_delete
Voice
Posts: 31
Joined: Fri Nov 24, 2006 5:31 am

Post by cannot_delete »

it worked, thx =)
Post Reply