LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-03-2012, 02:19 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Question Cron Not Working on CentOS


I've got a LAMP server running CentOS 5.7 & noticed a script I had in /etc/cron.hourly wasn't being ran. I checked /var/log/cron and it's completely empty:

Code:
[root@lamp]# ls -la /var/log/cron
-rw------- 1 root root 0 Jun 23 2010 /var/log/cron
So I don't think I have the correct packages installed for cron.

I searched my systems for all installed packages with the name "cron" in it:

Code:
[root@lamp:~]# rpm -qa | grep -i "cron"
crontabs-1.10-8
That's all that came up. Am I missing something? There's no startup / shutdown scripts in /etc/init.d/ either. Any ideas what I'm missing?
 
Old 01-03-2012, 02:32 PM   #2
kbscores
Member
 
Registered: Oct 2011
Location: USA
Distribution: Red Hat
Posts: 259
Blog Entries: 9

Rep: Reputation: 32
crontabs is the only file you need.

Try running crontab -l

if it doesn't come up than it didn't get saved -- I reccommend using
Code:
crontab -e 

0**** /path/command

Remember:


* * * * * Command to be executed
- - - - -
| | | | |
| | | | +----- Day of week (0-7)
| | | +------- Month (1 - 12)
| | +--------- Day of month (1 - 31)
| +----------- Hour (0 - 23)
+------------- Min (0 - 59)
 
Old 01-03-2012, 02:47 PM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
I'm very confused...

I have the package 'crontabs' installed:

Code:
[root@lamp:~]# rpm -qa | grep -i "crontabs"
crontabs-1.10-8
But when I try and list / edit crontabs, I get the following:

Code:
[root@lamp:~]# crontab -l
-bash: crontab: command not found
 
Old 01-03-2012, 04:07 PM   #4
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Is the cron daemon running?

Code:
# pgrep crond
If not:
  1. Is it installed? You're looking for the vixie-cron package.
  2. Is the service started? (/etc/init.d/crond)
 
Old 01-03-2012, 04:08 PM   #5
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by carlosinfl
Am I missing something? There's no startup / shutdown scripts in /etc/init.d/ either. Any ideas what I'm missing?
Just noticed this. There's nothing in /etc/init.d at all? (You're certainly missing something, if correct.)
 
Old 01-03-2012, 04:22 PM   #6
sleddog
Member
 
Registered: Jan 2002
Location: Labrador, Canada
Distribution: CentOS, Debian
Posts: 182

Rep: Reputation: 35
You don't have the cron daemon.

[root@server] yum install vixie-cron

Will fix you up.
 
Old 01-04-2012, 10:16 AM   #7
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
OK so I ran the command to install the package you suggested:

Code:
[root@lamp:~]# yum install vixie-cron

Running Transaction
  Installing     : vixie-cron                                                                                                                                                             1/1

Installed:
  vixie-cron.x86_64 4:4.1-77.el5_4.1
Now I can see the startup / shutdown script in /etc/init.d/

Code:
[root@lamp:~]# /etc/init.d/crond start
Starting crond:                                            [  OK  ]
Now how can I verify that the script '00awstats' that is stored in the /etc/cron.hourly/ directory is properly ran? Is there a way I can verify the script is running?
 
Old 01-04-2012, 12:48 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by carlosinfl View Post
how can I verify that the script '00awstats' (..) is properly ran? Is there a way I can verify the script is running?
How about just 'grep 00awstats /var/log/cron'?
 
  


Reply



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
Cron, DDclient and CentOS 5.1 metallica1973 Linux - Server 5 12-10-2008 11:01 PM
Why cron uses old version java in my VPS (centos 5)?? enes1177 Linux - Server 2 07-03-2008 05:49 AM
cron.daily, cron.weekly not working mwhite74 Linux - Server 2 06-07-2007 09:51 AM
fetchmail - why does CentOS 5 not like my old cron job? mazzo Linux - Server 2 04-23-2007 03:02 PM
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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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