LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-01-2010, 11:21 AM   #1
edgarosy
LQ Newbie
 
Registered: Oct 2007
Posts: 22

Rep: Reputation: 0
Crontab question.


I setup a cron job to trigger a script that I wrote every morning at 12:00 AM, but it does not seem to be working.

This is how I edit the job using crontab -e

00 * * * * ~/bin/outofstockreport.sh

Can someone please tell me what's wrong with this? Why it isn't triggering at 12:00 am every night. If I run the script manually it works just fine so I know is not the script causing troubles.

Thanks all.
 
Old 06-01-2010, 11:22 AM   #2
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Try removing the tilde and using the full path to the script.
 
Old 06-01-2010, 11:24 AM   #3
dr_strangelove
LQ Newbie
 
Registered: Jun 2010
Location: London, UK
Posts: 10

Rep: Reputation: 0
Is there anything in your CRONTAB that is running?

Could you check that CRON is running by typing the following at the terminal prompt:

Code:
$ ps -ax | grep cron
If it's running, you should see at least two lines in response.

Although, my response having been pipped to the post - AlucardZero's response is much more sensible.

Last edited by dr_strangelove; 06-01-2010 at 11:25 AM.
 
Old 06-01-2010, 11:25 AM   #4
jamescondron
Member
 
Registered: Jul 2007
Location: Scunthorpe, UK
Distribution: Ubuntu 8.10; Gentoo; Debian Lenny
Posts: 961

Rep: Reputation: 70
Well what is it doing? And how are you invoking it when you run it its self? What about

Code:
grep cron /var/log/syslog
 
Old 06-01-2010, 12:33 PM   #5
edgarosy
LQ Newbie
 
Registered: Oct 2007
Posts: 22

Original Poster
Rep: Reputation: 0
If I do a ps -ax | grep cron I get this result:

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
root 2111 0.0 0.0 5268 928 ? Ss Jan19 0:04 crond
triprd 22104 0.0 0.0 3908 652 pts/1 R+ 11:29 0:00 grep cron

I am trying to execute a java command that references a Jar file that it works if I run manually by typing java -jar then the file name. But for some reason the schedule setup in cron does not trigger the file which I have located under the ~/bin/outofstockreport.sh
 
Old 06-01-2010, 01:14 PM   #6
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Try removing the tilde and using the full path to the script.
 
Old 06-01-2010, 02:32 PM   #7
edgarosy
LQ Newbie
 
Registered: Oct 2007
Posts: 22

Original Poster
Rep: Reputation: 0
I will give that a try. Thanks AlucardZero and everyone else.
 
Old 06-01-2010, 04:31 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,592

Rep: Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880Reputation: 5880
FYI
Quote:
00 * * * * ~/bin/outofstockreport.sh
Should run every hour at 00 minutes...

As already stated cron has a limited environment and its always best to include full paths.
 
  


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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
crontab question mmoor Fedora 5 05-20-2006 03:50 PM
crontab question kaplan71 Linux - General 4 07-18-2005 04:04 PM
crontab question... j_miguel_y Linux - General 1 06-23-2004 05:19 PM
Crontab question mikeshn Linux - General 3 09-06-2003 06:26 PM
crontab question WeNdeL Linux - Newbie 1 03-06-2003 10:24 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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