Table of Contents

Install cron on a Server - REHL 6.6

Author: Yanjun Wang

Introduction

The cron is a time-based job scheduler. People who set up and maintain software environments use cron to schedule jobs to run periodically at fixed times, dates, or intervals. It typically automates system maintenance or administration.


Process and Commands

Connect to the desired server (the installing process need root permission or use sudo):

    ssh root@hostname

Determine if the cronie package is already installed:

    rpm -q cronie

If the cronie package is not installed, try to install the cronie package through yum firstly:

    yum install cronie

From the message from the server, if the current system is not registered to Red Hat Subscription Management, using local package file to install cronie. Or if it shows the installing process and finally “complete”, no need to do the further steps for installing the cronie package.

For installing the cronie package from a local file, check the machine hardware name/the architecture of the server firstly to determine the version of the cronie package file:

    uname –m

Or check the cronie package on other servers for reference.

Download a right cronie resource file from a resource website depending on the architecture of the server. (As a reference, here I download cronie-1.4.4-12.el6.x86_64.rpm from https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html , this file also can be found on our Google Drive: https://drive.google.com/open?id=0B1NnfrRA1ePVTkdLQ05zNjBuQTA)

Upload the cronie package file from your server to the remote desired server through ssh:

    scp /localpath/cronie.rpm root@hostname:/remotepath

Change directory to /remotepath, install the cronie package:

    rpm -ivh cronie.rpm

If the return message shows that there need other dependencies for this package, check if these dependencies are needed on the other servers. If the answer is Yes, install these dependencies package following the same process with installing cronie. Or if the answer is that they are not essential, use options to install the cronie package by force: –nodeps –force

So the command should be:

    rpm -ivh cronie.rpm --nodeps –force

The process of installing cron is now finished.

The following part is about turning on the cron service.

Determine if the service is running:

    service crond status

Run the crond service:

    service crond start

Configure the service to be automatically started at boot time:

    chkconfig crond on

After turning the cron service on, comment out all the current running crons through crontab if needed.


References

RedHat Guide for Automating System Tasks: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/ch-Automating_System_Tasks.html

Resource for cronie package: https://www.rpmfind.net/linux/rpm2html/search.php?query=cronie