Menu
User

DropVPS Team

Writer: Cooper Reagan

How to Setup Cron Jobs on Red Hat 9/8

How to Setup Cron Jobs on Red Hat 9/8

Publication Date

09/29/2025

Category

Articles

Reading Time

2 Min

Table of Contents

Keeping your server tasks automated helps maintain performance, security, and uptime. On Red Hat Enterprise Linux (RHEL) 9 and 8, the built-in cron scheduler can run commands or scripts automatically at the times you choose. Here’s how to configure it clearly and effectively.

Update Your System

Always begin with an updated system to avoid compatibility issues:

sudo dnf update -y

Install and Enable Cron

Cron on RHEL is provided by the cronie package. Check if it’s already installed:

rpm -q cronie

If it’s missing, install it:

sudo dnf install cronie -y

Then make sure the cron service is enabled and running:

sudo systemctl enable crond
sudo systemctl start crond
systemctl status crond

Understand the Cron Syntax

Each cron job follows a specific time pattern before the command you want to execute:

* * * * * command_to_run
- - - - -
| | | | └─ Day of the week (0–7, Sunday = 0 or 7)
| | | └─── Month (1–12)
| | └───── Day of the month (1–31)
| └─────── Hour (0–23)
└───────── Minute (0–59)

For example, 0 0 * * * runs something every day at midnight, while 0 3 * * 0 runs it every Sunday at 3 AM.

Add or Edit Cron Jobs

To create or change tasks for your user, open the crontab file:

crontab -e

Add one command per line, using the schedule format above. When you’re done, save and exit.

Practical Examples

You might schedule a backup every midnight like this:

0 0 * * * /usr/local/bin/backup.sh

To keep the system updated weekly:

0 3 * * 0 dnf update -y

To clear log files daily:

0 1 * * * find /var/log -type f -name "*.log" -delete

Manage and Troubleshoot

See the cron jobs you’ve set for your user:

crontab -l

Remove all jobs if you need a fresh start:

crontab -r

If something doesn’t run, review the logs:

journalctl -u crond
grep CRON /var/log/cron

Reliable Automation for RHEL

Using cron on Red Hat 9/8 gives you control over maintenance tasks, backups, and system updates without manual effort. For fast and secure RHEL servers built for professionals, visit DropVPS — optimized hosting for Linux automation and development.

Linux VPS
U
Loading...

Related Posts

How to Setup Cron Jobs on Red Hat 9/8