LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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-03-2009, 12:44 PM   #1
yngjzy
LQ Newbie
 
Registered: Jan 2009
Posts: 2

Rep: Reputation: 0
Crontab + Auto-fetch FTP file


Hey everyone, I've come to stumbling block in a bash script I've written. The bash script auto-fetches a file from an FTP server and does some processing on it. Heres the issue I'm having:

- I've added the script as a cron job
0 7 * * * /execute/my/script

- When the cron job is run, I get an email from root with a body that says "Unknown command".

Looking through the contents of the output when running the script, it seems the problem is this line:
500 Unknown command

The 500 Unknown command is sent from the FTP server to the FTP client. The weird thing is when you manually log into the FTP server using the ftp command, it will always give a 500 Unknown command for the first command you issue, then it will not display it again. For example:

# ftp XX.XX.XX.XX -i -n
Connected to XX.XX.XX.XX.
220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 6 of 50 allowed.
220-Local time is now 11:36. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 3 minutes of inactivity.
ftp> user XXX XXX
331 User XXX OK. Password required
230-User XXX has group access to: 450
230 OK. Current directory is /
Remote system type is UNIX.
Using binary mode to transfer files.

ftp> ls
500 Unknown command
227 Entering Passive Mode (XX,XX,XX,X,XX,XX)
150 Accepted data connection
drwx---r-x 2 4807 450 4096 Jan 3 09:00 .
drwx---r-x 2 4807 450 4096 Jan 3 09:00 ..
-rw-r--r-- 1 4807 450 23146 Nov 5 15:16 somefile.txt
-rw-r--r-- 1 4807 450 30262 Jan 3 09:00 some.txt
226-Options: -a -l
226 4 matches total

ftp> ls
227 Entering Passive Mode (XX,XX,XX,XX,XX,XX)
150 Accepted data connection
drwx---r-x 2 4807 450 4096 Jan 3 09:00 .
drwx---r-x 2 4807 450 4096 Jan 3 09:00 ..
-rw-r--r-- 1 4807 450 23146 Nov 5 15:16 somefile.txt
-rw-r--r-- 1 4807 450 30262 Jan 3 09:00 some.txt
226-Options: -a -l
226 4 matches total

It does not effect the file transfer, but as I stated earlier it is tripping up cron. Anyone have any ideas on this? Thanks for your help
 
Old 01-03-2009, 01:03 PM   #2
repo
LQ 5k Club
 
Registered: May 2001
Location: Belgium
Distribution: Arch
Posts: 8,529

Rep: Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899Reputation: 899
Why don't you use wget?
 
Old 01-03-2009, 01:25 PM   #3
yngjzy
LQ Newbie
 
Registered: Jan 2009
Posts: 2

Original Poster
Rep: Reputation: 0
repo, thanks for the reply. I was not aware of that tool, but it seems to be working. I will continue to monitor this.

Thanks again.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Fetch x lines from file G00fy Programming 17 07-18-2008 01:13 PM
[SOLVED] Script for auto-audio-recording - Crontab ctkroeker Linux - General 24 11-27-2006 04:24 AM
Crontab auto-updater RaelOM Programming 8 11-09-2006 07:05 AM
Freebsd 6.1 / Install webmin fails (can not fetch file) fatum112 *BSD 1 10-04-2006 06:05 AM
File Fetch service like Europe Online dr_doom Linux - Software 0 04-06-2004 03:28 PM

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

All times are GMT -5. The time now is 08:37 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