LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   [SOLVED] Cron doesn't seem to work for me! (https://www.linuxquestions.org/questions/linux-software-2/%5Bsolved%5D-cron-doesn%27t-seem-to-work-for-me-910020/)

krisbee 10-25-2011 06:41 AM

[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


hen770 10-25-2011 06:51 AM

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

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

Post the results here.

krisbee 10-25-2011 07:09 AM

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)...

hen770 10-25-2011 11:29 AM

Quote:

Originally Posted by krisbee (Post 4507610)
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 .

krisbee 10-25-2011 12:32 PM

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.

hen770 10-25-2011 03:05 PM

Env data isn't take into account with cron, you should put the Env variables yourself in the beeining of the crontab file.

krisbee 10-25-2011 09:12 PM

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)



All times are GMT -5. The time now is 06:23 PM.