Crontab is a system daemon used to execute desired tasks at designated times. It assumes that the system is on continuously . If the system is shutdown , when the ob is scheduled , it is not executed . crontab is used to maintain crontab files for individual users . Each users can have their own crontab . To use cron services , you must install vixie-cron rpm . you also have to verify that crond service is running on your system . In this short article i will explain how to use crontab in linux .

To install vixie-cron , use command given below –

The output of above command looks like –

vixie-cron

To check the package, it is installed or not . Run the command given below –

The output of above command looks like –

how to use crontab

To check the status of the crond service , use the command given below –

crond
If crond service is not running . start the service using command given above.

The main configuration file of crontab is /etc/cronatb

The output of above command looks like –

crontab

The first four line in above output are variables , which is used to configure environment in which cron jobs run .

To start & stop the crond service use the command given below –

The output of above command looks like –

crond

There are two access controlling to cron files available in linux.

If the file cron.allow exist in your system , only user listed in it are allow to use cron and cron.deny file is ignored . but if cron.allow does not exist , user listed in cron.deny are not allowed to use cron .

To list , edit and remove crontab job , use command given below –

crontab

Example of cron job –

We have to create a cron job in which it record memory uses of the system every monday at 2:40 AM in the file /tmp/meminfo

cron_job

Field and Range – 

crontab field and range

You may also like to read following article :

In this short article , we have explained about how to use crontab in linux.  Please subscribe to newsletter for updated articles. We will discuss about many other topics in next articles.