Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Server
User Name
Linux - Server This forum is for the discussion of Linux Software used in a server related context.


  Search this Thread
Old 08-21-2014, 05:17 AM   #1
LQ Newbie
Registered: Jul 2014
Location: West Michigan
Posts: 29

Rep: Reputation: Disabled
Cron not working after several tries

Redhadt RHEL 5.5.56 on a physical machine, not a virtual machine

Cron doesn't seem to be working. I have cron working on an Ubuntu box so I know the basics of cron, but cron does not seem to be working on the Redhat box. This is the first time I tried to use cron on this Redhat box.

- Email is not set up on this system at all so no chance of me getting error messages in email from cron. (I get error messages/output from cron in email on my Ubuntu box.)

If there is a mail package already installed, let me know what it is, I can try it. But this is a mission critical box, and if I install a package, and a single library changes, it can clobber the whole box and we are in deep shite. (I've had the occasional, but annoying problem with this on Windows.)

- I added my user to /etc/cron.allow. What other users have to be in cron.allow? Because it was blank when I edited it as root.

- Each line in my personal crontab ends with CR.

- I made a test script to run called 'gotest' which should put an entry in a log file every 2 minutes but nothing happens to the log file. I can run 'gotest' manually just fine and it puts an entry in my logfile in my home dir.

Could this be a permissions problem of the scripts cron is calling? My permissions of the script 'gotest' called in the crontab looks like this:

-rwxrwxrwx 1 chuck wheel 139 Aug 21 06:34 gotest*
The contents of gotest are this:

set logfile=/export/home/comp/perl/foo/automail2014/logcron.txt
echo `date`, `whoami` ran $0 >> $logfile
Logfile permissions:
-rw-rw-rw- 1 chuck wheel  283 Aug 20 08:05 logcron.txt
- 'gotest' is supposed to run every 3 minutes. 'gocron' is supposed to run every 10 minutes. My personal crontab:

# Crontab file for user 'chuck'
# Aug 19, 2014
# Every line MUST end with CR. 
# Fields: 1)Minutes, 2)Hour, 3)Day of month 1-31, 4)Month 1-2 5)Day of week 0 (sunday)-6 or names, 6)Command
10 * * * * /export/home/comp/perl/foo/automail2014/gocron
3 * * * * /export/home/comp/perl/foo/automail2014/gotest
- When I do '/etc/init.d/crond start' it says cron is already running. When I do '/etc/init.d/crond restart' I don't get an error, and cron seems to restart.

- Output from an alias which does 'ls -lut /etc/init.d/cron; ls -lut /etc/crontab; ls -lut /etc/cron.hourly; ls -lut /etc/cron.daily; ls -lut /var/spool/cron' shows this. I restarted cron on Aug 20 8:09am, but something ran on Aug 21 at 4:02am.

# ls -lut /etc/init.d/crond
-rwxr-xr-x 1 root root 1926 Aug 20 08:09 /etc/init.d/crond*
# ls -lut /etc/crontab
-rw-r--r-- 1 root root 255 Aug 20 08:09 /etc/crontab
# ls -lut /etc/cron.hourly
total 0
# ls -lut /etc/cron.daily
total 56
lrwxrwxrwx 1 root root   39 Aug 21 06:14 0logwatch -> /usr/share/logwatch/scripts/*
-rwxr-xr-x 1 root root  296 Aug 21 04:03 rpm*
-rwxr-xr-x 1 root root  100 Aug 21 04:03 tetex.cron*
-rwxr-xr-x 1 root root  354 Aug 21 04:03 tmpwatch*
-rwxr-xr-x 1 root root  256 Aug 21 04:03 rhsmd*
-rwxr-xr-x 1 root root  137 Aug 21 04:02 mlocate.cron*
-rwxr-xr-x 1 root root 2181 Aug 21 04:02 prelink*
-rwxr-xr-x 1 root root  418 Aug 21 04:02 makewhatis.cron*
-rwxr-xr-x 1 root root  118 Aug 21 04:02 cups*
-rwxr-xr-x 1 root root  180 Aug 21 04:02 logrotate*
-rwxr-xr-x 1 root root  379 Aug 21 04:02 0anacron*
# ls -lut /var/spool/cron/
total 4
-rw------- 1 chuck root 390 Aug 21 06:05 chuck
- doing 'ps -ae|grep cron' yields this:

29271 ?        00:00:00 crond
- /var/log/cron gets updated with something. Looks like my test script is running. Here's /var/log/cron, last few lines:

Aug 21 04:10:01 xpp crond[6756]: (chuck) CMD (/export/home/comp/perl/foo/automail2014/gocron)
Aug 21 05:01:01 xpp crond[6951]: (root) CMD (run-parts /etc/cron.hourly)
Aug 21 05:03:01 xpp crond[6960]: (chuck) CMD (/export/home/comp/perl/foo/automail2014/gotest)
Aug 21 05:10:01 xpp crond[6996]: (chuck) CMD (/export/home/comp/perl/foo/automail2014/gocron)
Aug 21 06:01:01 xpp crond[7298]: (root) CMD (run-parts /etc/cron.hourly)
Aug 21 06:03:01 xpp crond[7337]: (chuck) CMD (/export/home/comp/perl/gilson/automail2014/gotest)
Aug 21 06:05:22 xpp crontab[7370]: (chuck) BEGIN EDIT (chuck)
Aug 21 06:06:04 xpp crontab[7370]: (chuck) END EDIT (chuck)
Aug 21 06:10:01 xpp crond[7397]: (chuck) CMD (/export/home/comp/perl/foo/automail2014/gocron)
Aug 21 06:22:10 xpp crontab[7496]: (chuck) LIST (chuck)
- I've already taken a look at some pages I googled with no luck.

Any ideas what else I can check? Should we reboot the server? We just rebooted on Monday.

Last edited by bulrush15; 08-21-2014 at 06:01 AM.
Old 08-21-2014, 05:28 AM   #2
Registered: Nov 2013
Location: Pune, India
Distribution: CentOS
Posts: 70

Rep: Reputation: Disabled
Have you checked whether the script 'gotest' has executable permission?

- Bhushan
Old 08-21-2014, 05:40 AM   #3
LQ Newbie
Registered: Jul 2014
Location: West Michigan
Posts: 29

Original Poster
Rep: Reputation: Disabled
Yes it has exe permission for all people. I just added that to my original post.

EDIT: Got it! When I put root in /etc/cron.allow, and restarted cron it worked.

Last edited by bulrush15; 08-21-2014 at 06:25 AM.


cron, redhat

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
SVN working copy shared via NFS or local SVN working copies + cron job? deoren Linux - Server 2 10-04-2013 09:11 AM
[SOLVED] Script not working in cron but working fine manually jasperux Linux - Newbie 2 07-04-2012 11:28 PM
/USR/SBIN/CRON --> Suspicious Capital Letter, cron is not working??? arfal Linux - Server 10 06-22-2012 06:40 AM
cron.daily, cron.weekly not working mwhite74 Linux - Server 2 06-07-2007 09:51 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:58 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration