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.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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:


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

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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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,

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!

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.
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.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux OS Dev

From novice to tech pro — start learning today.