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 help required

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

ftp help required

Post by blake »

Hey can any one help with an ftp script i need to be able to upload some files to my website via my eggdrop every couple of minutes but the bot will need to do it auto ive tried the scripts in the archives and none of them seem to work properly any help greatly appreciated
w
willyw
Revered One
Posts: 1203
Joined: Thu Jan 15, 2009 12:55 am

Re: ftp help required

Post by willyw »

blake wrote:Hey can any one help with an ftp script i need to be able to upload some files to my website via my eggdrop every couple of minutes but the bot will need to do it auto ive tried the scripts in the archives and none of them seem to work properly any help greatly appreciated
I remember doing something like this, some time ago though.

As I recall, I didn't use the bot at all. You might give this some thought.

Try using an ftp script instead. Just have it log into your other server, and upload the files - don't involve the bot at all.

You can schedule the script's runs, with crontab.

I seem to remember that there was some minor little trick to writing a script file that worked properly. I'm sure I found it, just by googling.
Give it a try... google for things like:
linux ftp script
and
linux ftp commands
and, if you need help with crontab, you can google it too, or visit:
http://ss64.com/bash/


I hope this helps.
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Re: ftp help required

Post by blake »

I need it to work with an eggdrop because i have a few different files that need uploading to different directories on my website so the script will be working on to different eggdrops doing it through my shell will make this difficult
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Well, here's some ftp uploader code I wrote for my pisg files, minus the pisg functionality (because it's probably redundant to you):

Code: Select all

#FTP Host:
set daFTPsite "ftp.site.com"

#FTP User:
set daFTPuser "ftpuser"

#FTP Pass:
set daFTPpass "ftppass"

#Local Location:
set daFTPlocal "/directory/on/your/shell"

#Remote Location
set daFTPremote "./directory/to/your/websites/home/directory"

bind time - "* * * * *" timed:upload

bind pub m "!upload" command:upload

proc timed:upload {m h d m y} {
global daFTPsite daFTPuser daFTPpass daFTPlocal daFTPremote

	set ftp [open "|/usr/bin/ftp -n $daFTPsite" w]
	putlog "FTP: Starting FTP Upload..."
	puts $ftp "user $daFTPuser $daFTPpass"
	puts $ftp "bin"
	puts $ftp "put $daFTPlocal/index.html $daFTPremote/index.html"
#	puts $ftp "put $daFTPlocal/gigirc.html $daFTPremote/gigirc.html"
#	puts $ftp "put $daFTPlocal/pingbad.html $daFTPremote/pingbad.html"
	puts $ftp "quit"
	close $ftp
	putlog "FTP: Upload Complete."
}

proc command:upload {nick uh hand chan args} {
global daFTPsite daFTPuser daFTPpass daFTPlocal daFTPremote

	set ftp [open "|/usr/bin/ftp -n $daFTPsite" w]
	putlog "FTP: Starting FTP Upload..."
	puts $ftp "user $daFTPuser $daFTPpass"
	puts $ftp "bin"
	puts $ftp "put $daFTPlocal/index.html $daFTPremote/index.html"
#	puts $ftp "put $daFTPlocal/gigirc.html $daFTPremote/gigirc.html"
#	puts $ftp "put $daFTPlocal/pingbad.html $daFTPremote/pingbad.html"
	puts $ftp "quit"
	close $ftp
	putlog "FTP: Upload Complete."
}

putlog "ftp uploader by Trixar_za Loaded..."
You could probably modify the above code to suit your needs. If you provide me the relative directories on the shell and website, I can code that in for you.

The above should trigger every minute.
m
madpinger
Voice
Posts: 12
Joined: Sun Oct 03, 2010 3:06 pm

Post by madpinger »

Trixar_za wrote:Well, here's some ftp uploader code I wrote for my pisg files, minus the pisg functionality (because it's probably redundant to you):

Code: Select all

#               min hr day month yr
bind time - "*     *   *     *      *" timed:upload
TIME (stackable)
bind time <flags> <mask> <proc>
proc-name <minute> <hour> <day> <month> <year>

Just cause I expect it to be asked ;)
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Have tried the above script still not doing anything do my eggy need to have anything else added to it for this to work correctly

Also what permissions need to be set on the web directory its currently set to 755 also should the directory be creayed in public_ftp or in a home directory

Had this error on typing !upload

Code: Select all

Tcl error [command:upload]: couldn't execute "/usr/bin/ftp": no such file or directory
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

Try replacing:

Code: Select all

set ftp [open "|/usr/bin/ftp -n $daFTPsite" w]
with

Code: Select all

set ftp [open "|ftp -n $daFTPsite" w]
I know some *nix distros have a weird placement of the ftp command.
Post Reply