Operations 4 min read

Understanding Linux cron (crond) and Managing Scheduled Tasks

This article explains Linux's cron daemon (crond), its role in system and user task scheduling, how to view and edit crontab files, write cron expressions, manage the crond service, and common commands for listing, locating, and removing scheduled jobs.

Practical DevOps Architecture
Practical DevOps Architecture
Practical DevOps Architecture
Understanding Linux cron (crond) and Managing Scheduled Tasks

In Linux, scheduled tasks are controlled by the cron service (crond). The service is started by default because Linux already has many periodic jobs, and users can also create their own tasks using the crontab command.

1. Introduction to crond

crond is a daemon that executes tasks periodically or waits for events, similar to Windows Task Scheduler. After the OS installation, the service is installed and automatically started. Every minute crond checks for tasks to run and executes them.

Linux task scheduling is divided into two categories: system task scheduling and user task scheduling.

System task scheduling handles periodic system work such as flushing cache data to disk or cleaning logs. The configuration file for system tasks resides in /etc/crontab .

Task schedule file format:

cat /etc/crontab
SHELL=/bin/bash

Define a task schedule:

crontab -e

Note: When defining a task schedule, it is best to use absolute paths for commands to avoid problems.

Example: Execute 123.sh at 03:00 on Tuesdays and Fridays during the 1st‑10th days of every even month, appending standard output to /tmp/123.log and error output to /tmp/456.log :

0 3 1-10 */2 2,5 /bin/bash /user/loacl/sbin/123.sh >>/tmp/123.log 2>>/tmp/456.log

Ensure the service is running before using the schedule:

systemctl start crond

Check whether the service is running:

ps aux | grep cronroot
566  0.0  0.0 126232  1664 ?        Ss   12:42   0:00 /usr/sbin/crond -n
root   1707  0.0  0.0 112676   984 pts/0    S+   13:52   0:00 grep --color=auto cron

List task schedules:

crontab -l

Location of the task schedule file (useful for backup):

/var/spool/cron/username

Specify a user:

crontab -u username

Delete a task schedule:

crontab -r
operationstask schedulinglinuxCronSystem Administrationcrontab
Practical DevOps Architecture
Written by

Practical DevOps Architecture

Hands‑on DevOps operations using Docker, K8s, Jenkins, and Ansible—empowering ops professionals to grow together through sharing, discussion, knowledge consolidation, and continuous improvement.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.