In this lab, you will schedule a recurring job using cron.
| Resources | |
|---|---|
| Machines: | desktopX |
Outcomes
A recurring job is scheduled, and then removed again.
Log into your desktopX machine as student.
Schedule a recurring job that...
...runs as your student user.
...runs every two minutes between 09:00 and
16:59 on Monday to Friday.
...appends the current date and time to the file
/home/student/my_first_cron_job.
Start the crontab editor.
[student@desktopX ~]$crontab -e
Insert the following line:
*/2 9-16 * * 1-5 date >> /home/student/my_first_cron_job
Save your changes and quit the editor (:wq).
Inspect all of your scheduled cron jobs.
[student@desktopX ~]$crontab -l
Wait for your job to run at least once or twice, then inspect the
contents of the /home/student/my_first_cron_job
file.
[student@desktopX ~]$cat ~/my_first_cron_job
Remove all of the cron jobs for student.
[student@desktopX ~]$crontab -r