Lesson 29 / 29

systemd & cron

Managing services, and scheduling recurring jobs.

systemctl — manage services

systemd runs background services on most modern distros; systemctl is how you control them.

sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl status nginx

Output:

● nginx.service - A high performance web server
   Active: active (running) since Thu 2026-09-04 09:00:00 IST

cron — schedule recurring jobs

cron runs commands on a schedule you define, using five time fields: minute, hour, day-of-month, month, day-of-week.

crontab -e

crontab -e opens your personal crontab for editing.

# run backup.sh every day at 2:30 AM
30 2 * * * /home/alice/backup.sh

Quick check: Which tool is used to run a script automatically every night at a fixed time?

  • systemctl
  • cron
  • scp
Answer

cron — cron is Linux's built-in job scheduler for recurring tasks.