Linux+ 2.3.3: Scheduling jobs
A cron job that runs every minute, the environment cron jobs get, and a
one-off job with at.
Before you start
Work as root. The lab makes sure cron is installed and running, and
removes old copies of the files the tasks create in /tmp. Two of the
tasks take a few minutes of waiting.
Tasks
- Add a job to your crontab that appends the output of
dateto/tmp/cron-test.txtevery minute. When it has run at least twice, remove the job from your crontab again (keep the file). - Add a job to your crontab that writes its environment (
env) to/tmp/cron-env.txtevery minute. When it has run, compare that file with your shell's environment, then remove the job (keep the file). - Install
atif needed and make sureatdis running and starts at boot. Schedule a one-off job that creates/tmp/at-rantwo minutes from now, and wait for it.
Hints
(crontab -l 2>/dev/null; echo '* * * * * ...') | crontab -,crontab -l | grep -v PATTERN | crontab -.diff <(sort /tmp/cron-env.txt) <(env | sort): cron'sPATHandSHELLare minimal.systemctl enable --now atd,echo 'touch /tmp/at-ran' | at now + 2 minutes,atq.- The chapter's step 4 (anacron and
/etc/crontab) isn't graded.