December 21, 2006

Sheduled Task in Linux - Cron

by @ 11:52 am. Filed under Linux Hosting

Sheduled task in Linux - Cron

A cron is scheduled task in Linux which executes at certain time interval - for example, to take back-up every morning. Cron is also a daemon process. Deamon are the processes which started at the boot time and contineously running untill they are being stoped.
Cron scans the file Crontab every minute and checks every line. It triggers if the specified time/date information matches the current time/date. If they are equal, the command line specified will be executed. A log file (cron.log) with the executed commands is written to the current directory.
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

If cron jobs are stopped to working check the service status of crond by the command service crond status. If it is stopped, start it.
To start the crond service, use the command service crond start.
To stop the service, use the command service crond stop.
To list the cron jobs for the paricular user give the command
crontab -l -u username
To edit the cron jobs for the paricular user give the command
crontab -e -u username

Leave a Reply

You must be logged in to post a comment.

RESELLER HOSTING | DEDICATED SERVER | PREMIUM HOSTING | VPS HOSTING

Micfo Hosting

Micfo International LLC Leading the hosting Industry with Cheap and Affordable Linux Web Hosting Packages.

internal links:

categories:

archives:

Services:

Micfo Hosting

Micfo, delivering the best cpanel web hosting with maximum reliability is our exclusive focus.
Micfo International LLC

search blog:

TOP 10 POSTS:

Pages:

General Links:

Syndicate

other:

35 queries. 0.098 seconds