LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-18-2008, 06:55 AM   #1
mabin
LQ Newbie
 
Registered: Oct 2008
Posts: 15

Rep: Reputation: 0
Expect script to automate ftp upload


#!/usr/bin/expect
spawn ftp ftp.remotedomain.com
expect "Name (ftp.remotedomain:root):"
send "username\r" //provide the username here
expect "Password:"
send "password\r" //provide the password here
expect "ftp>"
send "lcd /var/log/httpd\r" //any desired location
expect "ftp>"
send "put *.acslog\r" //any file
expect "ftp>"
send "bye\r"
#interact

Hope the script is self explanatory. You need to have "expect" rpm installed on the server and you can run it as
#expect scriptname
or you can put the above command in a file and can make it a bash executable.

With little modifications you can use this script for automating ssh logging also.
If anyone want help on that just post it here I will post taht code also
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 10-18-2008, 07:08 AM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Moved to Linux - General, as it's not a security issue.

Last edited by win32sux; 10-18-2008 at 07:50 AM.
 
Old 12-19-2018, 04:27 AM   #3
TheBobGeezer
LQ Newbie
 
Registered: Dec 2018
Posts: 2

Rep: Reputation: Disabled
Thumbs up Simpler Approach

ftp -in 192.168.0.2 < ftpbatch

In ftpbatch, use the following
user anonymous anonymous@e-mail.address
get file1.txt
get file2.txt
close
 
Old 12-19-2018, 04:40 AM   #4
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
I would have hoped that in the 10 years since the last post in this thread that the world had moved away from ftp and to sftp / scp / rsync as much better options.
 
2 members found this post helpful.
Old 12-19-2018, 06:48 AM   #5
TheBobGeezer
LQ Newbie
 
Registered: Dec 2018
Posts: 2

Rep: Reputation: Disabled
He he TT. Some legacies never fade. We have to support and test FTP it seems, as people still use it. It works for them.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
script to automate EDI by FTP wademac Programming 4 04-14-2008 01:34 PM
ftp upload script problem. please help pinkygoyal Programming 8 02-15-2008 03:20 PM
buggy ftp upload script rblampain Programming 5 05-20-2007 12:30 AM
Automate FTP session using Shell Script kalyanofb Programming 2 04-07-2007 08:44 AM
Kermit Script to Automate FTP SSL/TLS fiddelm3742 Linux - Software 0 05-18-2004 11:53 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration