FTP scripts running under unix or linux

Big up.

I'm trying to get an automated ftp script working. It needs to update and backup from the development server to the live server, but that's near to irrelevant.

What I need is a sample, working ftp script with username/password authentication which sends a file over. If someone can give me any hints on how to call an executable after the script has launched on the target server, that would be welcome as well.

Thanks,

T
LVL 4
binkzzAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jlevieConnect With a Mentor Commented:
If I were doing this I'd use ncftpget/ncftpput from the ncftp client package. It's the most straightforward way I know of. A script that would copy a file to a remote and (assuming a successful transfer) run a remote command is quite simple, just commands like:

#!/bin/sh

ncftpput -u user -p passwd host.our.com /path-remote-dir /local-host/file
if [ $? = 0 ]; then
  rsh host.our.com run-my-command
fi

If you don't have the ncftp package on you system, you can find the latest stuff at www.ncftp.com. There's lots more that you can do with ncftpget/ncftpput, including recursive copies, check out the man pages.
0
 
binkzzAuthor Commented:
That's fantastic. I haven't got time to try it at the moment, but I will first thing tomorrow morning.

At which point I'll probably find it's working and I shall reward you the appropriate amount of points.

Cheers dude,

T
0
 
binkzzAuthor Commented:
That's working, but my remote server has no ftp deamon running and neither has it ncftp installed. And seeing it's not my machine, I can't install it either.

Sigh, back to the drawing board.

Cheers dude!

T
0
 
jlevieCommented:
You do have a login account on the remote, right? Get the ncftp source (www.ncftp.org), unpack it in your remote home dir and build it. It doesn't have to be installed by root to be useable. If the remote allows rsh, you can invoke the script on the remote w/o even telneting in.
0
 
binkzzAuthor Commented:
That's great. I've actually made a similar solution using rcp, but I don't feel it's secure enough so I recogn I shall try this ncftp.

Cheers G.

T
0
All Courses

From novice to tech pro — start learning today.