DropVPS Team
Writer: Cooper Reagan
How to Setup Cron Jobs on Centos 8

Table of Contents
What you will read?
Cron is a time-based job scheduler in Linux that allows you to automate repetitive tasks such as backups, updates, or running scripts. On CentOS 8, cron is managed through the cronie package, which is usually installed by default.
Step 1: Update System Packages
Before setting up cron jobs, update your CentOS system:
sudo dnf update -y
Step 2: Install Cron (if not installed)
Check if cronie is installed:
rpm -q cronie
If it’s not installed, run:
sudo dnf install cronie -y
Step 3: Enable and Start the Cron Service
Make sure the crond service is running and enabled at startup:
sudo systemctl enable crond
sudo systemctl start crond
Verify the status:
systemctl status crond
Step 4: Edit the User Crontab
To schedule tasks, use the crontab command:
crontab -e
This opens the crontab file in the default text editor. Each cron job follows this format:
* * * * * command_to_run
- - - - -
| | | | |
| | | | └── Day of week (0 - 7, Sunday = 0 or 7)
| | | └──── Month (1 - 12)
| | └────── Day of month (1 - 31)
| └──────── Hour (0 - 23)
└────────── Minute (0 - 59)
Step 5: Examples of Cron Jobs
-
Run a script every day at midnight:
0 0 * * * /home/user/myscript.sh -
Run a backup every Sunday at 2 AM:
0 2 * * 0 /usr/local/bin/backup.sh -
Run a command every 5 minutes:
*/5 * * * * /usr/bin/command
Step 6: Manage Cron Jobs
-
View current user’s cron jobs:
crontab -l -
Remove all cron jobs for the current user:
crontab -r - List system-wide cron jobs:
cat /etc/crontab
You have successfully set up cron jobs on CentOS 8. With cron, you can easily automate tasks to save time and ensure processes run on schedule.
For more Linux tutorials and VPS solutions, visit dropvps.com.