Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 964
Rep:
cron+script+FTP
Hi all
I was wondering if it is possable to create a .sh script to connect to an FTP account then upload a certain file, then add it to the crontab to upload every hour or so
It's much easier to automate this if you have ssh access as you can simply use rsync and ssh keys. But the FTP is possible. Check out the Bash Advanced Scripting Guide at www.tldp.org or the like as I believe they have a sample script that connects to FTP sites, etc.
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 964
Original Poster
Rep:
I own the PC box I'm working on, I have access to root and ssh any time, I was going to see if I could get my linux box to conntect to another FTP on my lan and then upload a couple of files every night, was hoping that I could make another .sh script file again to do the job.
All I need is to open up the FTP server in IIS to recive files from the Linux box, if you get my drift on what I'm trying to do.
better than that, there are 2 programs: wget and curl, they can transfer from one single file to an entire site, using proxies, authenticated logins, etc.
For transfer files from another computer you have administrative access, you may use rsync. Rsync has features like transport over a ssh tunnel and can make differential downloads, transfering only the changes from the previous transfer, saving time and bandwidth.
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 964
Original Poster
Rep:
any ideas please.
I've been at it for awhile now with no luck, I just tested the FTP by command line and it works.
when I ran the script it just hangs and I get this
Code:
./ftp_up_load.sh
ftp: connect: Connection timed out
Not connected.
Not connected.
Not connected.
I ran the script first via command line to see if it would work
here is the script
Code:
#!/bin/bash
ftp -n $202.xx.xx.xx <<END_SCRIPT
quote USER $My_user
quote PASS $My_password
put $my_picture.jpeg
quit
END_SCRIPT
exit 0
this below is from the command line
Code:
ftp> open 202.xx.xxx.xxx
Connected to 202.xx.xxx.xxx.
220 Microsoft FTP Service
500 'AUTH GSSAPI': command not understood
500 'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
Name (202.xx.xxx.xxx:root): My_user
331 Password required for My_user.
Password:
230 User My_user logged in.
Remote system type is Windows_NT.
ftp> cd uploading
250 CWD command successful.
ftp> put my_picture.jpeg
local: my_picture.jpeg remote: my_picture.jpeg
227 Entering Passive Mode (202,xx,xx,xx,xx,176)
125 Data connection already open; Transfer starting.
226 Transfer complete.
607177 bytes sent in 19 seconds (31 Kbytes/s)
ftp> bye
I must be missing some thing
last lot of errors that came up on the command line where
Code:
ftp> bye
./ftp_up_load.sh: line 4: quote: command not found
./ftp_up_load.sh: line 5: quote: command not found
./ftp_up_load.sh: line 6: put: command not found
./ftp_up_load.sh: line 7: quit: command not found
./ftp_up_load.sh: line 8: END_SCRIPT: command not found
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.