LinuxQuestions.org
Visit Jeremy's Blog.
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 06-09-2005, 10:09 AM   #1
compuser
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Rep: Reputation: 0
Trying to schedule ftp login using cron


Hi everyone,
I have a fairly limited knowledge of linux and am having an unusual problem. I am trying to use cron to schedule automatic updates of my dat files by logging into McAfee's ftp server and downloading them. I am trying to do this by using a script that I got from the McAfee site. The script contains two parts. One is the .netrc file which contains login details and which I place in the root home directory. The other is a script called update.sh which contains the commands for logging into the ftp server, checking for new dats and updating them if available.
What is unusual about my problem is that, if I am logged in as root, I can manually run the update.sh script and it works fine. However, when I schedule the script to run by placing it in /etc/cron.daily it does not work. The following are parts of the messages which are mailed to root on a daily basis:

login failed.
Name (ftp.nai.com:root): /etc/cron.daily/update.sh: line 31: [: *.ta: integer expression expected
tar: dat-*tar: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

I think the important part of the message is the "login failed" bit. The rest is simply due to the fact that the script cannot get to the dat files (due to the failed login obviously).
Because the script works when I run it manually I think it might have something to do with the fact that the .netrc file is inacessable when run using cron. I find this odd though as cron runs as root.

Does anybody have any ideas?
Thanks in advance
 
Old 06-09-2005, 11:03 AM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,564

Rep: Reputation: 124Reputation: 124
Could you post your crontab line ?
 
Old 06-10-2005, 04:22 AM   #3
compuser
LQ Newbie
 
Registered: Jun 2005
Posts: 3

Original Poster
Rep: Reputation: 0
Hi Keefaz,
I don't have any crontab line as such. I just put the script into the appropriate cron directory (in this case /etc/cron.daily). To do this I log in as a normal user and su to root. Is this ok or do I need to log in directly as root?
Here is a copy of the system crontab file (located in /etc/crontab). I don't suppose there's anything interesting in it though as its pretty much your standard crontab file!

I'd appreciate any help you can give me.

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts

# Run Every 5 Minutes
*/5 * * * * root run-parts /etc/cron.5min

# Run Backup each weekday @ 10PM
0 22 * * 1-5 root run-parts /etc/cron.backup

0 */2 * * * root run-parts /etc/cron.2hours

01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
 
  


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
FTP Script will not run from Cron grhansen Programming 12 01-13-2006 04:13 AM
How to schedule *interactive* task with at or cron fast_rizwaan Linux - Newbie 4 09-09-2005 06:26 PM
FTP Server Up and running... how do I hide ftp users from local login screen? joe1031 Mandriva 2 03-18-2005 04:24 PM
cron jobs work fine when invoked from webmin but fail on schedule jillu Linux - Enterprise 3 01-20-2005 01:34 PM
cron nightly backup to ftp server rkane Linux - Networking 2 03-04-2004 05:05 PM


All times are GMT -5. The time now is 07:58 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration