LinuxQuestions.org
Review your favorite Linux distribution.
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 01-12-2006, 04:50 AM   #1
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Rep: Reputation: 32
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

any idea's please

TT
 
Old 01-12-2006, 05:07 AM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
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.
 
Old 01-12-2006, 05:31 AM   #3
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Original Poster
Rep: Reputation: 32
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.

looking for that link now

TT
 
Old 01-12-2006, 05:34 AM   #4
marozsas
Senior Member
 
Registered: Dec 2005
Location: Campinas/SP - Brazil
Distribution: SuSE, RHEL, Fedora, Ubuntu
Posts: 1,499
Blog Entries: 2

Rep: Reputation: 68
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.

regards,

Last edited by marozsas; 01-12-2006 at 05:39 AM.
 
Old 01-12-2006, 05:36 AM   #5
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Original Poster
Rep: Reputation: 32
I know what wget that for downloading files as far as I know, never heard of curl before, I spose I have to read man curl

TT
 
Old 01-12-2006, 05:59 AM   #6
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Original Poster
Rep: Reputation: 32
I think I found some thing, I take it thats what you were meaning

Quote:
FTP

To ftp files using name+passwd, include them in the URL like:

curl ftp://nameasswd@machine.domainort/full/path/to/file

or specify them with the -u flag like

curl -u nameasswd ftp://machine.domainort/full/path/to/file
TT
 
Old 01-13-2006, 11:53 PM   #7
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 14.0.4 - Server Ubuntu 14.04.5 LTS
Posts: 963

Original Poster
Rep: Reputation: 32
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
TT
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
FTP Script will not run from Cron grhansen Programming 12 01-13-2006 04:13 AM
PPPD Script problem when cron-scheduling the script andresurzagasti Linux - Networking 0 11-24-2004 02:54 PM
Cron script help mpls mikeg Linux - Software 2 09-24-2004 09:28 AM
Help with Script and Cron goldstonrumpke Linux - Newbie 10 05-30-2004 11:51 PM

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

All times are GMT -5. The time now is 05:11 PM.

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