nixCraft Linux Forum

nixCraft

Linux Tech Support Forum

How do I configure Linux UNIX cron tasks?

This is a discussion on How do I configure Linux UNIX cron tasks? within the Getting started tutorials forums, part of the Linux Getting Started category; This is a common question asked by many user and here is the answer: /etc/contab is main configuration file. Each ...


Go Back   nixCraft Linux Forum > Linux Getting Started > Getting started tutorials

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 06-12-2007, 02:31 AM
sweta's Avatar
Contributors
User
 
Join Date: Feb 2005
Location: New Delhi
My distro: Suse, RHEL, Vista
Posts: 151
Rep Power: 4
sweta will become famous soon enough
Post How do I configure Linux UNIX cron tasks?

This is a common question asked by many user and here is the answer:

/etc/contab is main configuration file.

Each line in the /etc/crontab file represents a task and has the following format:

Code:
minute hour day month dayofweek command
Understanding possible valid values:
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 or feb)
dayofweek - any integer from 0 to 7, where 0 or 7 represents Sunday (or the short name of the week such as sun or mon)
command - the command to execute or a shell script

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, 6-10 means the integers 6,7,8,9 and 10

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. For example, 0-59/ can be used to define every other five minute in the minute field.

Any lines that begin with a hash mark (#) are comments and are not processed.


To create a crontab as a user, login as that user and type the command crontab -e to edit the user's crontab
Code:
crontab -e
To run command foo every friday type
Code:
30 3 * * fri /path/to/foo
__________________
Friends - v-nessa - missyAdmin
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-12-2007, 11:34 PM
Junior Member
User
 
Join Date: Jul 2007
Location: Hyderabad
My distro: Redhat RHEL, Solaris
Posts: 29
Rep Power: 0
vaibhav.kanchan is on a distinguished road
Default

Hi,

I have tried the same but the command is not working for me in my system. I am using VMware server and RHEL 4 in this case. What could be the reason?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

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 On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Mini How to :: How to configure ssh keys on Linux Ashish Pathak Getting started tutorials 2 05-09-2008 08:30 PM
Linux Configure Name Resolution raj Networking, Firewalls and Security 1 03-28-2008 09:19 AM
How to close the tasks? jithendra Linux software 3 11-17-2006 08:59 AM
UNIX cron job setup how to gbdood Linux software 1 08-27-2006 10:07 AM
Linux how do I configure my modem? goku Linux software 1 07-17-2006 11:18 PM


All times are GMT +5.5. The time now is 05:02 PM.


Powered by vBulletin® Version 3.7.2 - Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36