LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-25-2011, 06:41 AM   #1
krisbee
Member
 
Registered: Jan 2006
Posts: 60

Rep: Reputation: 15
[SOLVED] Cron doesn't seem to work for me!


Every time I try to do something with cron, it never seems to work. I am using Mandriva 2010.2, and the last two entries were added by me to help backup my mythtv system and also run the listing service scheduler. I want them to run outside the normal directory cron times, so I have them seperate... however, they don't seem to want to run.

I edited /etc/crontab in an editor, then restarted the crond program. I even rebooted. These things don't run! If I run the command on the command line (and as the respective user), they work just fine.

What am I doing wrong?


Code:
[krisbee2010@localhost mythtv_backup]$ cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
MAILTO=""
HOME=/

# run-parts
01 * * * * root nice -n 19 run-parts --report /etc/cron.hourly
02 4 * * * root nice -n 19 run-parts --report /etc/cron.daily
22 4 * * 0 root nice -n 19 run-parts --report /etc/cron.weekly
42 4 1 * * root nice -n 19 run-parts --report /etc/cron.monthly
# myth-update
05 17 * * * root nice -n 19 /usr/bin/mythfilldatabase --refresh-today
# myth-backup
02 3 * * * krisbee2010 nice -n 19 /usr/local/bin/mythconverg_backup.pl

Last edited by krisbee; 10-25-2011 at 09:13 PM.
 
Old 10-25-2011, 06:51 AM   #2
hen770
Member
 
Registered: Oct 2010
Distribution: Arch
Posts: 136

Rep: Reputation: 7
Look in the following log files after the time of a job passed:

/var/log/messeges
/var/log/cron

Post the results here.
 
Old 10-25-2011, 07:09 AM   #3
krisbee
Member
 
Registered: Jan 2006
Posts: 60

Original Poster
Rep: Reputation: 15
I forgot to mention, I did look in /var/log/cron/info.log and error.log. No errors. Info log says it ran, but the reality is it didn't (otherwise I would see an additional file for the backup)...
 
Old 10-25-2011, 11:29 AM   #4
hen770
Member
 
Registered: Oct 2010
Distribution: Arch
Posts: 136

Rep: Reputation: 7
Quote:
Originally Posted by krisbee View Post
I forgot to mention, I did look in /var/log/cron/info.log and error.log. No errors. Info log says it ran, but the reality is it didn't (otherwise I would see an additional file for the backup)...
could you please post the logs here for us to see.
what is run ? just the cron program, or your program that you have put in the crontab file ?

try crontab -v , and inside there put your programs schedule .
 
Old 10-25-2011, 12:32 PM   #5
krisbee
Member
 
Registered: Jan 2006
Posts: 60

Original Poster
Rep: Reputation: 15
It says that the program ran that was listed in /etc/crontab. I am at work at the moment, so I can't post.

I think I read that sometimes with /etc/crontab and putting things in there don't work so well since environment data isn't translated there, and the preferred method is to use the crontab program and log in as each user and make their own seperate crontabs.

I am going to give this a try tonight to see how it works and post the results.
 
Old 10-25-2011, 03:05 PM   #6
hen770
Member
 
Registered: Oct 2010
Distribution: Arch
Posts: 136

Rep: Reputation: 7
Env data isn't take into account with cron, you should put the Env variables yourself in the beeining of the crontab file.
 
Old 10-25-2011, 09:12 PM   #7
krisbee
Member
 
Registered: Jan 2006
Posts: 60

Original Poster
Rep: Reputation: 15
Well, I don't know why, but running crontab as each user (changing the default editor to nano for ease) did the trick (as well as removing the /etc/crontab entries). To expand, I ran crontab -e to edit my crontab as my default account, and then switched to root and did the same thing, adding the entries I wanted to have run.

I guess I can changed this to solved, though it is a headscratcher why it didn't work the other way - I ran environmental values in /etc/crontab... oh well...

And since someone asked for me to show my /var/log/cron/info.log, I have done so...
Code:
Oct 24 03:02:01 localhost CROND[24088]: (krisbee2010) CMD (/usr/local/bin/mythconverg_backup.pl)
Oct 24 03:02:01 localhost CROND[24089]: (krisbee2010) CMD (/usr/local/bin/mythconverg_backup.pl)
Oct 24 17:05:01 localhost CROND[14424]: (root) CMD (/usr/bin/mythfilldatabase --refresh-today)
Oct 24 17:05:01 localhost CROND[14426]: (root) CMD (/usr/bin/mythfilldatabase --refresh-today)

Last edited by krisbee; 10-25-2011 at 09:17 PM.
 
  


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
My Cron Job Doesn't Work carlosinfl Linux - Server 8 06-07-2010 09:50 PM
Why my cron job doesn't work byng08 Linux - Newbie 7 11-26-2008 01:17 AM
My cron doesn't work but 'sudo -u john foo.sh' does guarriman Linux - Software 2 01-19-2007 02:51 PM
Resolving doesn't work with cron scardario Linux - Networking 1 09-19-2006 08:54 PM
Ssh Doesn't Work With Cron ? guano2 Linux - Networking 4 08-06-2005 12:57 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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