LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 09-20-2006, 08:02 AM   #1
mavinashbabu
LQ Newbie
 
Registered: Sep 2006
Posts: 7

Rep: Reputation: 0
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there.


Hey small confusion here,

I've several folders under /etc for cron which starts with cron.* like cron.d, cron.weekly, cron.hourly, cron.monthly, cron.daily.

Can some please let me know why there are so many cron.*'s available where an entry of a script in any of the folders will do.

I'm using RedHat Enterprise Linux 4.0

Thanks in advacne..

MAB.
 
Old 09-20-2006, 08:09 AM   #2
odcheck
Member
 
Registered: Aug 2006
Distribution: Fedora, CentOS, RHEL, Debian
Posts: 978

Rep: Reputation: 31
Its for the purpose of running tasks scheduled.
Have a look at this RedHat Page
 
Old 09-20-2006, 08:13 AM   #3
w3bd3vil
Senior Member
 
Registered: Jun 2006
Location: Hyderabad, India
Distribution: Fedora
Posts: 1,191

Rep: Reputation: 49
check this out.
Quote:
/etc/crontab file lists the times to run various cron directories with any files.
/etc/cron.hourly directory listing of hourly files to be run
/etc/cron.daily directory listing of daily files to be run
/etc/cron.weekly directory listing of weekly files to be run
/etc/cron.monthly directory listing of monthly files to be run
/etc/cron.allow file list of users allowed to use crontab (not always present)
/etc/cron.deny file list of users denied to use crontab (not always present)

The locations above are where you put your file to be run. Like a daily script to be run goes into the /etc/cron.daily directory. And a monthly file to the monthly directory (/etc/cron.monthly).
Quote:
Configuring a Cron Task

The main configuration file for cron, /etc/crontab, contains the following lines:

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# 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

The first four lines are variables used to configure the environment in which the cron tasks are run. The value of the SHELL variable tells the system which shell environment to use (in this example the bash shell), and the PATH variable defines the path used to execute commands. The output of the cron tasks are emailed to the username defined with the MAILTO variable. If the MAILTO variable is defined as an empty string (MAILTO=""), email will not be sent. The HOME variable can be used to set the home directory to use when executing commands or scripts.

Each line in the /etc/crontab file has the format:

minute hour day month dayofweek command

*

minute — any integer from 0 to 59
*

hour — any integer from 0 to 23
*

day — any integer from 1 to 31 (must be a valid day if a month is specified)
*

month — any integer from 1 to 12 (or the short name of the month such as jan, feb, and so on)
*

dayofweek — any integer from 0 to 7 where 0 or 7 represents Sunday (or the short name of the week such as sun, mon, and so on)
*

command — the command to execute. The command can either be a command such as ls /proc >> /tmp/proc or the command to execute a custom script that you wrote.

For any of the above values, an asterisk (*) can be used to specify all valid values. For example, an asterisk for the month value means execute the command every month within the constraints of the other values.

A hyphen (-) between integers specifies a range of integers. For example, 1-4 means the integers 1, 2, 3, and 4.

A list of values separated by commas (,) specifies a list. For example, 3, 4, 6, 8 indicates those four specific integers.

The forward slash (/) can be used to specify step values. The value of an integer can be skipped within a range by following the range with /<integer>. For example, 0-59/2 can be used to define every other minute in the minute field. Step values can also be used with an asterisk. For instance, the value */3 can be used in the month field to run the task every third month.

Any lines that begin with a hash mark (#) are comments and are not processed.
 
1 members found this post helpful.
Old 09-21-2006, 01:44 PM   #4
mavinashbabu
LQ Newbie
 
Registered: Sep 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Thanks for the Reply guys..

I now able to understand why and what are THEY for.

MAB
 
Old 09-21-2006, 01:50 PM   #5
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 548

Rep: Reputation: 33
I'm not sure when this feature was added but it does make it easy to overlook a cron entry. I still prefer the old way (var/spool/cron/) but there is more than one way to skin a cat .....
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
cron.daily pigswillfly Ubuntu 6 08-10-2006 07:13 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 09:57 AM
cron.daily MrJoshua Linux - General 2 03-19-2003 12:09 PM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 02:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:54 AM.

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