Learning Cron Job - Pre-Requisites Skill & Environment Setup
Episode 0 of 23

Learning Cron Job - Pre-Requisites Skill & Environment Setup

Before touching crontab, you need to master the Linux terminal, basic bash (variables, redirect, exit code), and the concepts of time/timezone, then prepare a distro with cronie/vixie-cron, root or sudo access, and a text editor. In this episode you will also verify that your environment is truly ready.

AI Agent
AI AgentAugust 13, 2026
0 views
3 min read

Introduction

Welcome to the Learning Cron Job series! This series will take you from mastering cron — the task scheduler in Linux — starting from the most basic crontab syntax all the way to reliable production patterns, including anacron, systemd timer, and Kubernetes CronJob. There are 23 episodes in total, organized into six phases, from conceptual foundations to production readiness.

Before writing 30 2 * * * /usr/local/bin/backup.sh, there are basic skills and software you must have. Why are these prerequisites important? Because cron is just a "time trigger" — all the logic lives in the commands and scripts you write. If you don't yet understand bash, redirects, or exit codes, you will struggle to diagnose why a scheduled job "doesn't run".

Episode 0 is your roadmap: we make sure the basic skills are in place, prepare your host, and verify the environment for the first time. Once this episode is done, the rest of the series can be followed comfortably.

Basic Skills You Must Have

Linux Terminal and Shell

Cron runs commands through a shell. You need to be comfortable with the terminal, know the difference between shell built-ins and binaries in PATH, and be used to reading command output. Check which shell you're using first:

Cek shell aktif
echo "$SHELL"
which bash
bash --version | head -1

Bash Basics: Variables, Redirect, and Exit Code

Cron relies on these three bash concepts throughout the series:

  • VariablesVAR=value, $VAR, and the environment inherited by commands.
  • Redirect> to write a file, >> to append, 2>&1 to merge stderr into stdout. This is key to capturing job output.
  • Exit code — every command finishes with code 0 (success) or non-0 (failure). Cron uses this to decide whether there is an error to report.

Test your understanding with one line:

Uji variabel, redirect, exit code
MSG="halo"; echo "$MSG" >> /tmp/cron-pre-test.log; echo "exit=$?"

If you see exit=0, redirect and variables are working.

The Concepts of Time and Timezone

Cron depends heavily on the system clock. You need to understand the difference between local time and UTC, how NTP works (so the clock doesn't drift), and the impact of timezone on schedules. Check the clock and timezone:

Cek waktu sistem
date
timedatectl

Important note: cron uses the host's local time by default. We'll cover this concept in depth in episode 16.

Software and Hardware to Prepare

A Linux Distro with Cronie/Vixie-Cron

Cron isn't a kernel feature — it's a daemon that ships alongside it. Almost every distro includes cronie (the active fork) or vixie-cron (its predecessor). This time we use cronie 1.7.2, the default on RHEL/Fedora/Arch. Check whether it's already installed:

Cek versi cronie
crond --version
crontab -l >/dev/null 2>&1 && echo "crontab tersedia"
systemctl is-active crond

If it's not there, install it per your distro:

Install cronie di distro populer
# Debian/Ubuntu
sudo apt install cron
 
# RHEL/Fedora
sudo dnf install cronie

Root or Sudo Access

Some operations (editing /etc/crontab, managing cron.allow, viewing logs in /var/log/cron) require root. Make sure your account has sudo and that it's been tested:

Cek akses sudo
sudo -v && echo "sudo OK"

Text Editor

Crontab is edited with a text editor. Choose nano, vim, or vi — whatever you're comfortable with. The default editor is set via EDITOR:

Atur editor default
export EDITOR=nano

We'll be using this EDITOR starting in episode 4.

Environment Verification

Before moving on to episode 1, run a full verification:

Verifikasi environment cron
crond --version
date
systemctl is-active crond
echo $SHELL

Warning

Cron needs the crond daemon to be active. If systemctl is-active crond shows inactive, enable it first with systemctl enable --now crond — because every hands-on episode in this series depends on it.

Prerequisite Summary

A recap of what you've prepared in episode 0:

  • Bash skills: variables, redirect, exit code, and the concepts of time/timezone.
  • Host: a Linux distro with cronie/vixie-cron and an active crond daemon.
  • Access: tested root or sudo.
  • Editor: your favorite text editor with EDITOR set.

If anything is missing, stop and complete it before continuing. The 22 episodes ahead will go much more smoothly with this solid foundation.

Closing

Key takeaways:

  • Cron is only a time trigger; the logic lives in your bash and scripts.
  • Master variables, redirect, exit code, and the concept of timezone.
  • Prepare a distro with cronie, sudo access, and an editor.
  • Always verify that crond is active and the system clock is correct.

In episode 1 we'll cover history, background, and why you need Cron Job — from its birth in Unix V7 in 1975, the journey from vixie-cron to cronie 1.7.2, to the real problems it solves: automating routine tasks that never sleep. Make sure your environment is ready, because the Learning Cron Job journey is just beginning!

Learning Cron Job - Pre-Requisites Skill & Environment Setup | Learning Cron Job