LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Cron jobs not running (https://www.linuxquestions.org/questions/linux-enterprise-47/cron-jobs-not-running-498478/)

henrybg 11-04-2006 12:08 AM

Cron jobs not running
 
Hi Guys,

I have RedHat AS installed and running fine. On Oct. 3 I changed the time via the Desktop. Ever since that day, none of my cron jobs have run. Even after I have performed a reboot. I also tried a simple task where I touch a file in the tmp directory. That file has never been created. What could have caused my crond to stop processing stuff in the crontab?

Henry

rylan76 11-04-2006 01:14 AM

Have you taken a look if

1. Cron is running at all

2. That there is not some clue in its log file?

To test if cron is running, go to a terminal and do

ps -A | grep cron

I think its log file should be in

/val/log/cron.log

?

See if there is anything informative contained in there.

sundaralingam 11-04-2006 05:16 AM

Hi,

check if "ps -ef|grep cron" does not show cron is running.

1. chkconfig --list|grep cron
2. check for log file /var/log/cron

henrybg 11-04-2006 05:39 AM

Cron daemon is running. Here are the response to the suggestions thus far. Thanks in advance.

[root@onlinelv online]# ls -l /val/log/cron.log
ls: /val/log/cron.log: No such file or directory
[root@onlinelv online]# chkconfig --list|grep cron
anacron 0 off 1 off 2 on 3 on 4 on 5 on 6 off
crond 0 off 1 off 2 on 3 on 4 on 5 on 6 off
[root@onlinelv online]# ls -l /var/log/cron
-rw------- 1 root root 7110 Nov 4 06:26 /var/log/cron
[root@onlinelv online]# tail /var/log/cron
Nov 4 01:34:40 onlinelv crontab[311]: (root) LIST (root)
Nov 4 01:46:31 onlinelv crontab[382]: (root) BEGIN EDIT (root)
Nov 4 01:47:04 onlinelv crontab[382]: (root) REPLACE (root)
Nov 4 01:47:04 onlinelv crontab[382]: (root) END EDIT (root)
Nov 4 01:48:01 onlinelv crond[18317]: (root) RELOAD (cron/root)
Nov 4 06:26:56 onlinelv crontab[9671]: (root) LIST (root)

henrybg 11-04-2006 05:45 AM

Ohh! by the way, I am at runlevel 5.

Quigi 11-04-2006 01:42 PM

Quote:

Originally Posted by henrybg
Cron daemon is running. Here are the response to the suggestions thus far. Thanks in advance.

Did you check for the process crond, as sundaralingam and rylan76 suggested? Does ps -fC crond turn anything up? Then again, you have the one RELOAD entry from crond in the log, so it did something (maybe dying right after?).

Quote:

[root@onlinelv online]# chkconfig --list|grep cron
anacron 0 off 1 off 2 on 3 on 4 on 5 on 6 off
crond 0 off 1 off 2 on 3 on 4 on 5 on 6 off
OK, it seems configured so that is should run.
Quote:

[root@onlinelv online]# tail /var/log/cron
Nov 4 01:34:40 onlinelv crontab[311]: (root) LIST (root)
Nov 4 01:46:31 onlinelv crontab[382]: (root) BEGIN EDIT (root)
Nov 4 01:47:04 onlinelv crontab[382]: (root) REPLACE (root)
Nov 4 01:47:04 onlinelv crontab[382]: (root) END EDIT (root)
Nov 4 01:48:01 onlinelv crond[18317]: (root) RELOAD (cron/root)
Nov 4 06:26:56 onlinelv crontab[9671]: (root) LIST (root)
I don't see any entries showing CoMmanDs being run (matching your diagnosis). On mine, I see:
Code:

Oct 30 02:01:00 lithium CROND[8246]: (root) CMD (run-parts /etc/cron.hourly)
Oct 30 03:01:00 lithium CROND[8568]: (root) CMD (run-parts /etc/cron.hourly)
Oct 30 03:33:00 lithium CROND[8735]: (monce) CMD (/home/monce/script/consolidate 5 \%Y-\%m-\%d '??-??-??')
Oct 30 04:01:00 lithium CROND[8956]: (root) CMD (run-parts /etc/cron.hourly)

You see jobs for different users being run. The monce job is mine; root's run-parts apparently comes with Fedora Core.

Regarding your machine, I'm poking in the dark. Would you care sharing `crontab -l` for some user on your machine? Look in /var/log/messages? Run df to see if some file system filled up -- that can sometimes cause the most obscure errors?
BTW, if a cron job runs (which it didn't) and writes anything to stdout or stderr, cron will send it to the owner by e-mail.

henrybg 11-05-2006 02:59 AM

the messages file indicated that the cron failed because it could not get the tty.

From that info in the messages file I found my way to this helpful hint on the web regarding the use of pam.d I just realized that disabling direct sign-on for system accounts affected the cron job. However, I have all the recommendations in place as outlined below. Should I restart any daemon to make the active without a reboot?

NOTE:

In RHEL4 pam_access is already configured for crond:

# grep pam_access /etc/pam.d/*
/etc/pam.d/crond:account required pam_access.so accessfile=/etc/security/access-cron.conf
#

This means that the above entries in /etc/security/access.conf will stop cron from working. Note that it is very prudent to always check whether pam_access is configured for any other service on the system!

To ensure that all users on the system can still run cron jobs you can add the following argument to pam_access in /etc/pam.d/crond:

account required pam_access.so accessfile=/etc/security/access-cron.conf

This ensures that the /etc/security/access.conf configuration file is not invoked by crond. Since pam_cracklib does not grant permissions if the configuration file does not exist, execute the following command to create an empty file:

# touch /etc/security/access-cron.conf

Now verify that cron jobs can be launched by any user on the system.

alienslideshow 03-21-2011 10:54 AM

I've had problems using the /tmp directory for cron jobs in linux. Note that I do the same thing in HPUX, Solaris and AIX and have no problem. But for some reason in Linux I can't use the /tmp directory with my cron jobs and end up putting them in /root. Then they work as expected.

Can anyone explain this?

Nominal Animal 04-04-2011 05:04 PM

Quote:

Originally Posted by alienslideshow (Post 4298115)
I've had problems using the /tmp directory for cron jobs in linux.

Do you have noexec in the line containing /tmp in /etc/mtab ? If you do, you have specifically prohibited running programs and scripts from /tmp. I do it on CentOS, but not on Ubuntu. (On Ubuntu and possibly other Debian variants update scripts are run in /tmp or /var/tmp. Allowing exec on one but not the other makes very little sense, since they're both world-writable.)

mcoliver 10-11-2012 03:44 PM

Run the command:
ps aux | grep -i cron | grep -v grep

It should give you output like below:
root 20584 0.3 0.0 117240 1444 ? Ss 13:40 0:00 crond

If the crond process is not there try restarting it:
/etc/init.d/crond restart

crashfive 01-28-2013 10:23 AM

Did any of the above recommendation/possible solutions fix your problem? If so, can you state which? I'm having the same issue.


All times are GMT -5. The time now is 07:36 AM.