Install crond on centos 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
Also Read -> How to Install Visual Studio Code in Centos 8
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.)
Also Read -> How to Install Varnish with Apache on Centos 7
Now you view cronjobs and configure by using crontab
[root@lampblogs ~]# crontab -l
To view jobs scheduled under other user use below command.
crontab -u <username> -l
if you want to edit cronjob, then use following command.
###### For root user ######
crontab -e
##### For specific user #######
crontab -u <username> -e
Thats'it. Now you have learned how to install ctontab on centos 7 system.
you can follow our article about schedule cronjobs on Centos.
Also Read -> How to Install Odoo 14 on Centos 8