Schedule a recurring backup task using a user crontab and verify that it is installed correctly. Validate the job with crontab inspection, identify where cron activity is logged, and understand the role of system-wide cron directories.
Your team needs regular backups to run automatically. You have been asked to schedule a daily backup job using cron, confirm it is present in the user’s crontab, and identify where you would check for evidence when troubleshooting job execution.
Cron failures are often simple: the job was never installed, the schedule was wrong, or logs were never checked. This lab builds the habit of proving each piece with command output.
/usr/local/bin/backup.sh
at 02:00.
crontab -l
.
/etc/cron.d/
.
crontab -l
.
crontab -e
.
/etc/cron.d/
.
crontab -l
This confirms whether the user already has scheduled jobs. If no crontab exists, you will see a message indicating the crontab is empty or missing.
# Example (no jobs yet):
crontab: no crontab for vonds
crontab -e
This opens the per-user crontab in an editor. The editor may vary by system configuration, but the goal is the same: install a cron entry under the user’s account.
# Example message:
Editing crontab using nano. Use Ctrl+O to save, Ctrl+X to exit.
0 2 * * * /usr/local/bin/backup.sh
Cron format is:
MIN HOUR DOM MON DOW CMD
. This entry runs at minute 0 of hour 2 every day of the
month, every month, regardless of day-of-week.
# Confirm the entry is present in the crontab file you saved:
0 2 * * * /usr/local/bin/backup.sh
crontab -l
Always re-list the crontab after editing. This proves your entry was installed and helps catch editing mistakes before you wait for the schedule to trigger.
0 2 * * * /usr/local/bin/backup.sh
# Common locations (distro-dependent):
/var/log/syslog
/var/log/cron.log
Log locations vary by distro and logging configuration.
Debian/Ubuntu commonly record cron activity in
/var/log/syslog
. Some systems log cron to a dedicated
/var/log/cron.log
or include cron events in a general messages log.
# Example evidence patterns you might see:
CRON[12345]: (vonds) CMD (/usr/local/bin/backup.sh)
/etc/cron.d/
is for.
ls -l /etc/cron.d/
/etc/cron.d/
holds system-wide cron jobs that are managed as separate
files. Unlike user crontabs, entries here typically include
an explicit user field so a job can run as a chosen account.
# You should see one or more cron definition files (example):
anacron
e2scrub_all
php
crontab -l
: Lists the current user’s scheduled cron jobs.
crontab -e
: Edits the current user’s crontab in the configured editor.
MIN HOUR DOM MON DOW CMD
: Standard cron schedule fields used in user crontabs.
/var/log/syslog
: Common location for cron messages on Debian/Ubuntu
systems.
/var/log/cron.log
: Common dedicated cron log file on some systems.
/etc/cron.d/
: Directory for system-wide cron job definitions with an
explicit user field.