How To Install And Setup a Linux Crontab Task

First you will need to install cron on the system. Type the following to install cron in CentOS 6.

yum install vixie-cron

Set cron to start when the system starts by executing chkconfig.

chkconfig crond on
servcie crond start

Now that cron has been installed on the system you can add tasks to your cron tab. The crontab file is located in /etc/crontab (This is a file with no extension, not a folder). The file might contain something like this.

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

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

To make your life very easy there is a tool that will generate the crontab line for you. Use the form to setup frequency you want the task to run and it will provide you with the line of code that you add to your crontab file.

http://www.crontab-generator.org/

Related Articles

Related Questions

Is it safe to use open Wi-Fi at a hotel without a VPN?

Hey everyone! I'm currently at a hotel that offers open Wi-Fi, and I'm using it for social media and checking my emails. A friend...

Can’t Log Into Windows Without Internet – Need Help!

I just built a new PC but I can't log into Windows since I need to change my PIN, which requires an internet connection....

Is It Realistic to Learn Java and JavaScript at the Same Time?

I've always wanted to master Java because it's widely used in established companies. However, I keep seeing a lot of codes and projects involving...

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Latest Tools

OpenAI Token Calculator

This tool is a simple OpenAI token calculator, web-based utility designed to help you quickly estimate the number of tokens in your text when...

List Sorting Tool

Welcome to our innovative list ordering and management tool. This next-level platform enables you to sort a list of items in ascending or descending...

Sudoku Solver

Welcome to our free online Sudoku solving tool, an interactive platform for puzzle enthusiasts seeking a break from a Sudoku conundrum. This advanced platform...

Apply Image Filters To Image

Digital imagery in the modern world is all about reinforcing emotions and stories behind each photo we take. To amplify this storytelling, we are...

Add Watermark To Image

As the world is increasingly consumed by digital media, protecting your original images is paramount. We are thrilled to introduce you to our innovative...

CSV To Xml Converter

Welcome to our CSV to XML converter tool, a convenient and user-friendly solution for all your data conversion needs. This versatile tool on our...

Latest Posts

Latest Questions