LinuxQuestions.org
Help answer threads with 0 replies.
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 02-21-2008, 03:56 AM   #1
sinister1
Member
 
Registered: Jul 2007
Posts: 70

Rep: Reputation: 15
Cron Job only runs when it is manually started


Hello,

I have a problem which is really stupid.

I have a cronscript (ftpdownload.sh) with the lines below in it:

#!/bin/bash
DATUM=`date -d "-1 day" +"%Y-%m-%d"`;
HOST='ip adres server'
USER='user'
PASSWD='pass'
ftp -n $HOST <<END_SCRIPT
quote USER $USER
quote PASS $PASSWD
cd logs/wowza
get wowzamediaserverpro_access.log.$DATUM
get wowzamediaserverpro_stats.log.$DATUM
get wowza_stats_access.log.$DATUM
quit
END_SCRIPT
exit 0

It is a script who will download the logfiles to my local machine.

When i run this manually the script runs succesfully. When i put it in the crontab with the following line:

*/1 * * * * /scripts/ftpdownload.sh >> /tmp/my.log 2>&1

I found an article on the internet with the same problem:

http://www.linuxquestions.org/questi...b.-why-502661/

WHAT I TRIED:

changed the name of the script (with and without extension)
made the script 777
put the script in cron.daily.

Does anyone have any idea what this could be?

thanks..
 
Old 02-21-2008, 04:49 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Hi,
First, just as a matter of being picky, when you have */1 you are telling it to run every oneth minute. Easier to say just * which is every minute. That is quite often for my taste.
Also, try the /full/path/to/the/script in the crontab.
Next, be sure to restart crond after making changes.
 
Old 02-21-2008, 05:04 AM   #3
sinister1
Member
 
Registered: Jul 2007
Posts: 70

Original Poster
Rep: Reputation: 15
Hey,

Thank you for your reply.

I run it every minute because the testing i am doing.

The script is running from /scripts/ftpdownload.sh

So the full path is already present i think.
 
Old 02-22-2008, 06:48 AM   #4
sinister1
Member
 
Registered: Jul 2007
Posts: 70

Original Poster
Rep: Reputation: 15
i have changed a few things like location/ script but didn't worked any idea anyone?
 
Old 02-25-2008, 08:35 AM   #5
sinister1
Member
 
Registered: Jul 2007
Posts: 70

Original Poster
Rep: Reputation: 15
I have changed my cronjob in my crontab to this:

*/1 * * * * cd /scripts;./ftpdownload.sh >/dev/null 2>&1

And now it is working.

Thanks for the replies.
 
  


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
adding a perl script to cron.daily / cron.d to setup a cron job CrontabNewBIE Linux - Software 6 01-14-2008 08:16 AM
Script works when run manually but not in cron job Harlin Linux - Software 7 10-16-2007 06:36 PM
cron job runs but will not write to logfile c_curtis Linux - General 10 06-30-2006 09:25 AM
cron job only runs halfway aunquarra Linux - General 15 01-31-2005 04:53 PM
Why Does One Cron Job Runs Twice? cpope67 Programming 4 11-16-2004 06:09 AM

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

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