Search My Techie Guy

Thursday, August 20, 2020

Crontab -l: crontab: command not found - Fedora 32

Summary: 

[root@localhost ~]# crontab -l
-bash: crontab: command not found

Problem or Goal: 

To be able to schedule jobs/tasks using crontab on Fedora.
For example scheduling the cacti poller script to run every 5 mins

*/5 * * * *    root /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1


Cause: 

Crontab is not installed by default on Fedora

Solution: 

1. Fedora uses with the following automated task utilities: 

  • cron
  • anacron
  • at
  • batch

2. To install Cron and Anacron, run the following command:

[root@localhost cacti]# dnf install cronie cronie-anacron


3. Start the crond service

[root@localhost cacti]# systemctl start crond


Problem Solved? 

Yes

[root@localhost cacti]# crontab -l
no crontab for root

Use "crontab -e" command below to add your jobs/tasks

[root@localhost cacti]# crontab -e

for example the cacti poller job has been added

[root@localhost cacti]# crontab -l
*/5 * * * *    root /usr/bin/php /usr/share/cacti/poller.php > /dev/null 2>&1