Hamsa K
Editor
3 min read | 8 months ago

How to Install Crontab in Centos

Install crond on centos6/7/8

The daemon crond is pre-installed in almost all Linux servers. In few or very rare situations, we need to install it manually on servers.The daemon crond is using for job scheduling.Cronjobs are predefined jobs which are running periodically according to the settings we have done previously.

First we will check cron rpm is installed or not

[root@lampblogs ~]# rpm -qa | grep cronie

If you didn't found any packages related to cronie then install cronie like below

[root@lampblogs ~]# yum install cronie
===============================================================================================================================================================================================
 Package                                         Arch                                    Version                                                   Repository                             Size
===============================================================================================================================================================================================
Installing:
 cronie                                          x86_64                                  1.4.11-23.el7                                             base                                   92 k
Installing for dependencies:
 cronie-anacron                                  x86_64                                  1.4.11-23.el7                                             base                                   36 k
 crontabs                                        noarch                                  1.11-6.20121102git.el7                                    base                                   13 k
Transaction Summary
===============================================================================================================================================================================================
Install  1 Package (+2 Dependent packages)
Total size: 141 k
Total download size: 13 k
Installed size: 260 k
Is this ok [y/d/N]: y

After packages are installed check service is running or not. If its not running you can start with following commands and enable it for autostart.

[root@lampblogs ~]# systemctl status crond
[root@lampblogs ~]# systemctl start crond
[root@lampblogs ~]# systemctl enable crond

sample output

[root@lampblogs ~]# systemctl status crond
  crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2020-02-15 14:19:57 IST; 1s ago
 Main PID: 8345 (crond)
    Tasks: 1
   CGroup: /system.slice/crond.service
           ââ8345 /usr/sbin/crond -n
Feb 15 14:19:57 lampblogs.com systemd[1]: Started Command Scheduler.
Feb 15 14:19:57 lampblogs.com systemd[1]: Starting Command Scheduler...
Feb 15 14:19:57 lampblogs.com crond[8345]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 54% if used.)
Feb 15 14:19:57 lampblogs.com crond[8345]: (CRON) INFO (running with inotify support)
Feb 15 14:19:57 lampblogs.com crond[8345]: (CRON) INFO (@reboot jobs will be run at computer's startup.)

Now you view cronjobs and configure by using crontab

[root@lampblogs ~]# crontab -l
[root@lampblogs ~]# crontab -e

you can follow our article about schedule cronjobs on Centos.

 



Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy