>_ IzzyLab

Hands-on task

This task is step 3 of the course “Cron: scheduled jobs”

System job in /etc/cron.d

medium~5 min

Create a system cron job in the file /etc/cron.d/nightly: every day at 00:30, run /usr/local/bin/rotate.sh as the user root. Keep in mind that the /etc/cron.d format differs from a user crontab.

What you'll practise:
  • cron
  • /etc/cron.d
  • system jobs
  • crontab format

Topic breakdown

Unlike a user crontab, files in /etc/cron.d are system entries, and their format has an additional field: between the schedule (five time fields) and the command you specify the user the job runs as. These are ordinary text files that cron picks up on its own, without invoking the crontab utility. The understanding that the schedule is set by the five fields minute hour day month day_of_week is here extended with the knowledge of a sixth field — the username.

What's checked

  1. entry with root user field

What it looks like