nixCraft Linux / UNIX / Shell Scripting Forum

nixCraft

Linux / UNIX 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 ...


Register free or login to your account to remove all advertisements.

Go Back   nixCraft Linux / UNIX / Shell Scripting Forum > Linux Getting Started > Getting started tutorials

Linux answers from nixCraft.


Getting started tutorials So much to read, so little time! If that is your problem, we have solution. Read our FAQ and tutorials to help you cut through the clutter of information overload. Only members of "contributors" group can post new tutorials. Other members can just reply to thread.

Reply

 

Thread Tools Display Modes
  #1 (permalink)  
Old 12th June 2007, 02:31 AM
sweta's Avatar
Contributors
 
Join Date: Feb 2005
Location: New Delhi
OS: Suse, RHEL, Vista
Posts: 213
Thanks: 18
Thanked 11 Times in 11 Posts
Rep Power: 8
sweta has a spectacular aura aboutsweta has a spectacular aura aboutsweta has a spectacular aura about
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
__________________
Reply With Quote
  #2 (permalink)  
Old 12th July 2007, 11:34 PM
Member
 
Join Date: Jul 2007
Location: Hyderabad
OS: Redhat RHEL, Solaris
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 4
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


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 Off


Similar Threads

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


All times are GMT +5.5. The time now is 08:50 PM.


Powered by vBulletin® Version 3.8.6 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2010 nixCraft. All rights reserved

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 37 38 39 40