Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-26-2011, 04:41 AM   #1
LQ Newbie
Registered: Jan 2011
Posts: 2

Rep: Reputation: 0
Script crontab

Hello! I have a script( scheduled to run with Crontab at every hour. The script is all good and executes manually with [root@server cron.hourly]# ./
But the scrip is not executing according to schedule.
This is what I see in /var/log/cron every hour:
crond[4729]: (root) CMD (run-parts /etc/cron.hourly/

My crontab look likes this:

# run-parts
01 * * * * root run-parts /etc/cron.hourly/
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

Any suggestions?

Old 01-26-2011, 04:52 AM   #2
LQ Guru
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981Reputation: 1981
Hi and welcome to LinuxQuestions!

The system crontab /etc/crontab uses the run-parts command to run all the executable files inside the specified directory. You cannot put a file as argument to run-parts. Most likely the cron daemon has sent an error to root's mail, as
Not a directory: /etc/cron.hourly/
Leave the /etc/crontab file untouched and simply put the script inside the /etc/cron.hourly directory. Be sure it has executable permissions.

In alternative you can use the user's (or root's) specific crontab, using crontab -e.
Old 01-27-2011, 12:52 AM   #3
LQ Newbie
Registered: Jan 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Many thanks for your input, the scrip is executing according to schedule.

Previous I also had to add the following argument to pam_access in /etc/pam.d/crond:
account required accessfile=/etc/security/access-cron.conf.
And an empty file:
# touch /etc/security/access-cron.conf

Otherwise I got:
server pam_access[1566]: access denied for user `root' from `cron'
server crond[1566]: Permission denied

Many thanks!


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
Crontab not running script j8177e5 Linux - Newbie 2 12-21-2010 08:54 AM
Runs Multiple shell script inside a main script using crontab srimal Linux - Newbie 4 10-22-2009 06:19 PM
script no values if in crontab packets Programming 1 03-12-2009 06:29 PM
crontab and a bash script seefor Linux - General 6 01-27-2009 03:41 PM
Script having problem with Crontab DriveMeCrazy Programming 5 07-18-2005 03:29 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:35 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
Open Source Consulting | Domain Registration